classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: MetalToggleButtonUI


From: David Gilbert
Subject: [cp-patches] FYI: MetalToggleButtonUI
Date: Thu, 27 Oct 2005 09:35:33 +0100
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051026)

This patch (committed) moves the color field initialisation from the constructor to the installDefaults() method, fixing some failing Mauve tests:

2005-10-27  David Gilbert  <address@hidden>

        * javax/swing/plaf/metal/MetalToggleButtonUI.java:
        (MetalToggleButtonUI): removed color field initialisation,
        (installDefaults): added color field initialisation formerly in
        the constructor.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalToggleButtonUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java,v
retrieving revision 1.5
diff -u -r1.5 MetalToggleButtonUI.java
--- javax/swing/plaf/metal/MetalToggleButtonUI.java     25 Oct 2005 19:57:04 
-0000      1.5
+++ javax/swing/plaf/metal/MetalToggleButtonUI.java     27 Oct 2005 08:28:22 
-0000
@@ -55,7 +55,7 @@
 import javax.swing.plaf.basic.BasicToggleButtonUI;
 
 /**
- * A UI delegate for address@hidden JToggleButton} components.
+ * A UI delegate for the address@hidden JToggleButton} component.
  */
 public class MetalToggleButtonUI
   extends BasicToggleButtonUI
@@ -71,11 +71,11 @@
   protected Color disabledTextColor;
 
   /**
-   * Returns an instance of MetalToggleButtonUI.
+   * Returns a new instance of <code>MetalToggleButtonUI</code>.
    *
    * @param component the component for which we return an UI instance
    *
-   * @return an instance of MetalToggleButtonUI
+   * @return A new instance of <code>MetalToggleButtonUI</code>.
    */
   public static ComponentUI createUI(JComponent component)
   {
@@ -83,15 +83,11 @@
   }
 
   /**
-   * Constructs a new instance of MetalToggleButtonUI.
+   * Constructs a new instance of <code>MetalToggleButtonUI</code>.
    */
   public MetalToggleButtonUI()
   {
     super();
-    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-    focusColor = defaults.getColor(getPropertyPrefix() + "focus");
-    selectColor = defaults.getColor(getPropertyPrefix() + "select");
-    disabledTextColor = defaults.getColor(getPropertyPrefix() + 
"disabledText");
   }
 
   /**
@@ -115,9 +111,12 @@
   }
 
   /**
-   * Returns the color for the text label of disabled buttons.
+   * Returns the color for the text label of disabled buttons.  The value 
+   * is initialised in the address@hidden #installDefaults(AbstractButton)} 
method
+   * by reading the <code>ToggleButton.disabledText</code> item from the UI 
+   * defaults.
    *
-   * @return the color for the text label of disabled buttons
+   * @return The color for the text label of disabled buttons.
    */
   protected Color getDisabledTextColor()
   {
@@ -131,9 +130,11 @@
    */
   public void installDefaults(AbstractButton b)
   {
-    // FIXME: for now, this override just changes the visibility of the method
-    // in the super-class, to satisfy japi...but there must be something else.
     super.installDefaults(b);
+    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+    focusColor = defaults.getColor(getPropertyPrefix() + "focus");
+    selectColor = defaults.getColor(getPropertyPrefix() + "select");
+    disabledTextColor = defaults.getColor(getPropertyPrefix() + 
"disabledText");
   }
   
   /**

reply via email to

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