< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java

Print this page

        

@@ -75,10 +75,12 @@
      */
     protected Color disabledTextColor;
 
     private boolean defaults_initialized = false;
 
+    private TextUIDrawing textUIDrawing;
+
     // ********************************
     //        Create PLAF
     // ********************************
 
     /**

@@ -106,16 +108,21 @@
         if(!defaults_initialized) {
             focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
             selectColor = UIManager.getColor(getPropertyPrefix() + "select");
             disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
             defaults_initialized = true;
+            textUIDrawing = SwingUtilities2.getTextUIDrawing(textUIDrawing);
         }
     }
 
     protected void uninstallDefaults(AbstractButton b) {
         super.uninstallDefaults(b);
         defaults_initialized = false;
+        if (textUIDrawing != SwingUtilities2.DEFAULT_UI_TEXT_DRAWING
+                && textUIDrawing instanceof UIResource) {
+            textUIDrawing = SwingUtilities2.DEFAULT_UI_TEXT_DRAWING;
+        }
     }
 
     // ********************************
     //         Default Accessors
     // ********************************

@@ -210,11 +217,11 @@
                 g.setColor(c.getBackground());
             } else {
                 g.setColor(getDisabledTextColor());
             }
         }
-        SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemIndex,
+        textUIDrawing.drawStringUnderlineCharAt(c, g, text, mnemIndex,
                 textRect.x, textRect.y + fm.getAscent());
     }
 
     protected void paintFocus(Graphics g, AbstractButton b,
                               Rectangle viewRect, Rectangle textRect, Rectangle iconRect){
< prev index next >