Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Button insets



I'd like to see support in the RepaintManager for some kind of Decorator, where that decorator could draw beyond the getBounds() of the object. The way it would work is that decorators would be drawn by the UI peer, and the RepaintManager would extend the dirty area to account for that decoration. I've got code that does this, and it works well as long as your components are non-opaque.

John


On Sep 30, 2008, at 11:42 AM, Florijan Stamenkovic wrote:

Ken,

On Sep 30, 2008, at 09:53, Ken Orr wrote:

When creating a button like this:

JToggleButton button = new JToggleButton("Java Button");
button.setFocusable(false);
button.putClientProperty("JButton.buttonType", "square");

there is a 4 pixel border added around the button for the focus ring.
What is the recommended way to remove this border?

I'd go for bug reporting. A border's insets could (should???) be made to adapt to the focusability of the button. However, this is just an indication of a more significant issue: the fact that Swing borders normally do not paint outside of their component's boundaries. I believe this could be hacked, but would result in faulty repaints. Anyway, for me this has become simply "one of the Swing issues to accept", as it is observable with JComboBox, JCheckBox and other components too.


Adding it to a panel with a negative border?

JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder(-4,-4,-4,-4);
panel.add(button);

Wow, that's an interesting idea, and what's even more, it seems to work :) I have no idea how tolerant Swing's component arithmetic is of this, so it might cause problems somewhere, somehow.


F

actually, thinking more about it, it *might* be possible to make borders that paint outside of their components, but that trigger appropriate repaints in their component's parent that clear them when necessary. Huh, that'd go a long way towards a better Aqua LAF.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Button insets (From: Ken Orr <email@hidden>)
 >Re: Button insets (From: Florijan Stamenkovic <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.