/[classpath]/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.4 by gnu_andrew, Wed Nov 2 00:44:01 2005 UTC revision 1.1.2.5 by gnu_andrew, Sun Nov 27 21:00:41 2005 UTC
# Line 47  import java.awt.Rectangle; Line 47  import java.awt.Rectangle;
47  import javax.swing.AbstractButton;  import javax.swing.AbstractButton;
48  import javax.swing.JComponent;  import javax.swing.JComponent;
49  import javax.swing.JToggleButton;  import javax.swing.JToggleButton;
50    import javax.swing.SwingConstants;
51  import javax.swing.SwingUtilities;  import javax.swing.SwingUtilities;
 import javax.swing.UIDefaults;  
52  import javax.swing.UIManager;  import javax.swing.UIManager;
53  import javax.swing.plaf.ComponentUI;  import javax.swing.plaf.ComponentUI;
54  import javax.swing.plaf.basic.BasicButtonUI;  import javax.swing.plaf.basic.BasicButtonUI;
# Line 131  public class MetalToggleButtonUI Line 131  public class MetalToggleButtonUI
131    public void installDefaults(AbstractButton b)    public void installDefaults(AbstractButton b)
132    {    {
133      super.installDefaults(b);      super.installDefaults(b);
134      UIDefaults defaults = UIManager.getLookAndFeelDefaults();      focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
135      focusColor = defaults.getColor(getPropertyPrefix() + "focus");      selectColor = UIManager.getColor(getPropertyPrefix() + "select");
136      selectColor = defaults.getColor(getPropertyPrefix() + "select");      disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
     disabledTextColor = defaults.getColor(getPropertyPrefix() + "disabledText");  
137    }    }
138        
139    /**    /**
# Line 200  public class MetalToggleButtonUI Line 199  public class MetalToggleButtonUI
199      g.drawRect(fr.x - 1, fr.y - 1, fr.width + 1, fr.height + 1);      g.drawRect(fr.x - 1, fr.y - 1, fr.width + 1, fr.height + 1);
200      g.setColor(saved);          g.setColor(saved);    
201    }    }
202    
203      /**
204       * If the property <code>ToggleButton.gradient</code> is set, then a gradient
205       * is painted as background, otherwise the normal superclass behaviour is
206       * called.
207       */
208      public void update(Graphics g, JComponent c)
209      {
210        if (c.isOpaque() && UIManager.get(getPropertyPrefix() + "gradient") != null)
211          {
212            MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
213                                     SwingConstants.VERTICAL,
214                                     getPropertyPrefix() + "gradient");
215            paint(g, c);
216          }
217        else
218          super.update(g, c);
219      }
220        
221  }  }

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26