classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: fix opaque properties for buttons


From: Roman Kennke
Subject: [cp-patches] FYI: fix opaque properties for buttons
Date: Tue, 05 Jul 2005 15:56:58 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

Here comes a small fixlet that fixes how/where the opaque property for Buttons is initialized. According to some tests I have run, this property is not initialized in the buttons UI class, but instead in the buttons constructor. I have an application that uses a ToggleButton derived from JToggleButton but does not call super() in its constructors. These buttons look very ugly because they paint their background (because the opaque property is not initialized in the constructor).

2005-07-05  Roman Kennke  <address@hidden>

       * javax/swing/JToggleButton.java
       (constructor): Initialize the opaque property here.
       * javax/swing/plaf/basic/BasicButtonUI.java
       (installDefaults): Don't initialize the opaque property here.

/Roman

Index: javax/swing/JToggleButton.java
===================================================================
RCS file: /CVSROOT/Jamaica/src/classpath/javax/swing/JToggleButton.java,v
retrieving revision 1.11
diff -u -r1.11 JToggleButton.java
--- javax/swing/JToggleButton.java      5 Jul 2005 12:28:00 -0000       1.11
+++ javax/swing/JToggleButton.java      5 Jul 2005 13:49:53 -0000
@@ -79,6 +79,7 @@
       super();
       /* Register the accessible toggle button as a listener for item events */
       addItemListener(this);
+      setOpaque(true);
     }
 
     /**
Index: javax/swing/plaf/basic/BasicButtonUI.java
===================================================================
RCS file: 
/CVSROOT/Jamaica/src/classpath/javax/swing/plaf/basic/BasicButtonUI.java,v
retrieving revision 1.13
diff -u -r1.13 BasicButtonUI.java
--- javax/swing/plaf/basic/BasicButtonUI.java   5 Jul 2005 12:28:02 -0000       
1.13
+++ javax/swing/plaf/basic/BasicButtonUI.java   5 Jul 2005 13:49:53 -0000
@@ -130,7 +130,7 @@
     b.setIconTextGap(defaults.getInt(prefix + ".textIconGap"));
     b.setInputMap(JComponent.WHEN_FOCUSED, 
                   (InputMap) defaults.get(prefix + ".focusInputMap"));
-    b.setOpaque(true);
+    //b.setOpaque(true);
   }
 
   protected void uninstallDefaults(AbstractButton b)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]