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 MetalToggleButtonUI


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

I did implement the same missing methods as I did in MetalButtonUI in MetalToggleButtonUI.

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

        * javax/swing/plaf/metal/MetalToggleButtonUI.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/MetalToggleButtonUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java,v
retrieving revision 1.2
diff -u -r1.2 MetalToggleButtonUI.java
--- javax/swing/plaf/metal/MetalToggleButtonUI.java     2 Jul 2005 20:32:51 
-0000       1.2
+++ javax/swing/plaf/metal/MetalToggleButtonUI.java     22 Jul 2005 08:04:01 
-0000
@@ -38,7 +38,11 @@
 
 package javax.swing.plaf.metal;
 
+import java.awt.Color;
+
 import javax.swing.JComponent;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicToggleButtonUI;
 
@@ -46,7 +50,15 @@
   extends BasicToggleButtonUI
 {
 
-  // FIXME: maybe replace by a Map of instances when this becomes stateful
+  /** 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;
+
   /** The shared UI instance for MetalToggleButtonUIs */
   private static MetalToggleButtonUI instance = null;
 
@@ -56,6 +68,43 @@
   public MetalToggleButtonUI()
   {
     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]