classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: added getPropertyPrefix in javax.swing.plaf.basic.Basi


From: Roman Kennke
Subject: [cp-patches] FYI: added getPropertyPrefix in javax.swing.plaf.basic.BasicButtonUI
Date: Tue, 26 Apr 2005 12:24:05 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

I added the method getPropertyPrefix to javax.swing.plaf.basic.BasicButtonUI.

2005-04-26  Roman Kennke  <address@hidden>

       * javax/swing/plaf/basic/BasicButtonUI.java
       (getPropertyPrefix): Added.
       (installDefaults): Use getPropertyPrefix instead of hard-coded
       prefix.

/Roman

Index: javax/swing/plaf/basic/BasicButtonUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicButtonUI.java,v
retrieving revision 1.18
diff -u -r1.18 BasicButtonUI.java
--- javax/swing/plaf/basic/BasicButtonUI.java   19 Apr 2005 07:59:02 -0000      
1.18
+++ javax/swing/plaf/basic/BasicButtonUI.java   26 Apr 2005 10:21:03 -0000
@@ -107,17 +107,29 @@
     textShiftOffset = defaultTextShiftOffset;
   }
 
+  /**
+   * Returns the prefix for the UI defaults property for this UI class.
+   * This is &apos;Button&apos; for this class.
+   *
+   * @return the prefix for the UI defaults property
+   */
+  protected String getPropertyPrefix()
+  {
+    return "Button";
+  }
+
   protected void installDefaults(AbstractButton b)
   {
     UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-    focusColor = defaults.getColor("Button.focus");
-    b.setForeground(defaults.getColor("Button.foreground"));
-    b.setBackground(defaults.getColor("Button.background"));
-    b.setMargin(defaults.getInsets("Button.margin"));
-    b.setBorder(defaults.getBorder("Button.border"));
-    b.setIconTextGap(defaults.getInt("Button.textIconGap"));
+    String prefix = getPropertyPrefix();
+    focusColor = defaults.getColor(prefix + ".focus");
+    b.setForeground(defaults.getColor(prefix + ".foreground"));
+    b.setBackground(defaults.getColor(prefix + ".background"));
+    b.setMargin(defaults.getInsets(prefix + ".margin"));
+    b.setBorder(defaults.getBorder(prefix + ".border"));
+    b.setIconTextGap(defaults.getInt(prefix + ".textIconGap"));
     b.setInputMap(JComponent.WHEN_FOCUSED, 
-                  (InputMap) defaults.get("Button.focusInputMap"));
+                  (InputMap) defaults.get(prefix + ".focusInputMap"));
     b.setOpaque(true);
   }
 

reply via email to

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