classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: Implemented missing methods in MetalButtonUI


From: Roman Kennke
Subject: [cp-patches] FYI: Implemented missing methods in MetalButtonUI
Date: Fri, 22 Jul 2005 09:23:23 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

I implemented 3 missing methods in MetalButtonUI.

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

        * javax/swing/plaf/metal/MetalButtonUI.java
        (constructor): Initialize colors.
        (getFocusColor): Fetches the focus property from the UIDefaults.
        (getSelectColor): Fetches the select property from the UIDefaults.
        (getDisabledTextColor): Fetches the disabledText property from the
        UIDefaults.

/Roman
Index: javax/swing/plaf/metal/MetalButtonUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalButtonUI.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- javax/swing/plaf/metal/MetalButtonUI.java   2 Jul 2005 20:32:50 -0000       
1.5
+++ javax/swing/plaf/metal/MetalButtonUI.java   21 Jul 2005 15:23:35 -0000      
1.6
@@ -38,6 +38,8 @@
 
 package javax.swing.plaf.metal;
 
+import java.awt.Color;
+
 import javax.swing.AbstractButton;
 import javax.swing.JComponent;
 import javax.swing.JToolBar;
@@ -56,18 +58,60 @@
   extends BasicButtonUI
 {
 
-  // FIXME: probably substitute with a Map in the future in the case
-  // that this UI becomes stateful
-
   /** The cached MetalButtonUI instance. */
   private static MetalButtonUI instance = null;
 
+  /** The color for the focus border. */
+  protected Color focusColor;
+
+  /** The color that indicates a selected button. */
+  protected Color selectColor;
+
+  /** The color for disabled button labels. */
+  protected Color disabledTextColor;
+
   /**
    * Creates a new instance of MetalButtonUI.
    */
   public MetalButtonUI()
   {
     super();
+    focusColor = getFocusColor();
+    selectColor = getSelectColor();
+    disabledTextColor = getDisabledTextColor();
+  }
+
+  /**
+   * Returns the color for the focus border.
+   *
+   * @return the color for the focus border
+   */
+  protected Color getFocusColor()
+  {
+    UIDefaults def = UIManager.getLookAndFeelDefaults();
+    return def.getColor(getPropertyPrefix() + ".focus");
+  }
+
+  /**
+   * Returns the color that indicates a selected button.
+   *
+   * @return the color that indicates a selected button
+   */
+  protected Color getSelectColor()
+  {
+    UIDefaults def = UIManager.getLookAndFeelDefaults();
+    return def.getColor(getPropertyPrefix() + ".select");
+  }
+
+  /**
+   * Returns the color for the text label of disabled buttons.
+   *
+   * @return the color for the text label of disabled buttons
+   */
+  protected Color getDisabledTextColor()
+  {
+    UIDefaults def = UIManager.getLookAndFeelDefaults();
+    return def.getColor(getPropertyPrefix() + ".disabledText");
   }
 
   /**

reply via email to

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