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