[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: MetalButtonListener
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: MetalButtonListener |
Date: |
Wed, 28 Sep 2005 15:50:07 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20050728) |
I noticed that all buttons in the Swing demo are using a rollover border, thanks to
my patch yesterday. While that looks cool, it is wrong, and this patch fixes it:
2005-09-28 David Gilbert <address@hidden>
* javax/swing/plaf/metal/MetalButtonListener.java
(propertyChange): check new value of property to determine which
border to set.
I will think some more about how the default button border is restored when the
rollover state is set to false - right now it is restoring
MetalBorders.getButtonBorder(), but I'm not sure that will cover all cases correctly.
Regards,
Dave
Index: javax/swing/plaf/metal/MetalButtonListener.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalButtonListener.java,v
retrieving revision 1.1
diff -u -r1.1 MetalButtonListener.java
--- javax/swing/plaf/metal/MetalButtonListener.java 27 Sep 2005 21:51:50
-0000 1.1
+++ javax/swing/plaf/metal/MetalButtonListener.java 28 Sep 2005 14:35:48
-0000
@@ -72,10 +72,15 @@
super.propertyChange(e);
if (e.getPropertyName().equals(
AbstractButton.ROLLOVER_ENABLED_CHANGED_PROPERTY))
- {
- AbstractButton b = (AbstractButton) e.getSource();
- if (b.getBorder() instanceof UIResource)
- b.setBorder(MetalBorders.getRolloverBorder());
- }
+ {
+ AbstractButton b = (AbstractButton) e.getSource();
+ if (b.getBorder() instanceof UIResource)
+ {
+ if (Boolean.TRUE.equals(e.getNewValue()))
+ b.setBorder(MetalBorders.getRolloverBorder());
+ else if (Boolean.FALSE.equals(e.getNewValue()))
+ b.setBorder(MetalBorders.getButtonBorder());
+ }
+ }
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: MetalButtonListener,
David Gilbert <=