This fixes the BasicButtonUI to only touch the margin of a Button when it's a UIResource. This is important for theme and L&F switching, especially for buttons that are part of other components etc.
2006-03-17 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicButtonUI.java
(installDefaults): Only install UI margin if installed margin
is null or a UIResource.
(uninstallDefaults): Only uninstall margin if it's
a UIResource.
/Roman
--
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/plaf/basic/BasicButtonUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicButtonUI.java,v
retrieving revision 1.35
diff -u -r1.35 BasicButtonUI.java
--- javax/swing/plaf/basic/BasicButtonUI.java 13 Mar 2006 22:06:47 -0000 1.35
+++ javax/swing/plaf/basic/BasicButtonUI.java 17 Mar 2006 20:48:12 -0000
@@ -156,7 +156,8 @@
LookAndFeel.installColorsAndFont(b, prefix + "background",
prefix + "foreground", prefix + "font");
LookAndFeel.installBorder(b, prefix + "border");
- b.setMargin(UIManager.getInsets(prefix + "margin"));
+ if (b.getMargin() == null || b.getMargin() instanceof UIResource)
+ b.setMargin(UIManager.getInsets(prefix + "margin"));
b.setIconTextGap(UIManager.getInt(prefix + "textIconGap"));
b.setInputMap(JComponent.WHEN_FOCUSED,
(InputMap) UIManager.get(prefix + "focusInputMap"));
@@ -176,7 +177,8 @@
if (b.getBorder() instanceof UIResource)
b.setBorder(null);
b.setIconTextGap(defaultTextIconGap);
- b.setMargin(null);
+ if (b.getMargin() instanceof UIResource)
+ b.setMargin(null);
}
protected BasicButtonListener listener;
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
