/[classpath]/classpath/javax/swing/plaf/basic/BasicButtonUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicButtonUI.java

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

revision 1.12.2.7 by gnu_andrew, Sat Sep 10 15:31:50 2005 UTC revision 1.12.2.8 by gnu_andrew, Tue Sep 20 18:46:33 2005 UTC
# Line 55  import javax.swing.UIDefaults; Line 55  import javax.swing.UIDefaults;
55  import javax.swing.UIManager;  import javax.swing.UIManager;
56  import javax.swing.plaf.ButtonUI;  import javax.swing.plaf.ButtonUI;
57  import javax.swing.plaf.ComponentUI;  import javax.swing.plaf.ComponentUI;
58    import javax.swing.plaf.UIResource;
59    
60  public class BasicButtonUI extends ButtonUI  public class BasicButtonUI extends ButtonUI
61  {  {
# Line 122  public class BasicButtonUI extends Butto Line 123  public class BasicButtonUI extends Butto
123    {    {
124      UIDefaults defaults = UIManager.getLookAndFeelDefaults();      UIDefaults defaults = UIManager.getLookAndFeelDefaults();
125      String prefix = getPropertyPrefix();      String prefix = getPropertyPrefix();
126        b.setFont(defaults.getFont(prefix + "font"));
127      focusColor = defaults.getColor(prefix + "focus");      focusColor = defaults.getColor(prefix + "focus");
128      b.setForeground(defaults.getColor(prefix + "foreground"));      b.setForeground(defaults.getColor(prefix + "foreground"));
129      b.setBackground(defaults.getColor(prefix + "background"));      b.setBackground(defaults.getColor(prefix + "background"));
# Line 130  public class BasicButtonUI extends Butto Line 132  public class BasicButtonUI extends Butto
132      b.setIconTextGap(defaults.getInt(prefix + "textIconGap"));      b.setIconTextGap(defaults.getInt(prefix + "textIconGap"));
133      b.setInputMap(JComponent.WHEN_FOCUSED,      b.setInputMap(JComponent.WHEN_FOCUSED,
134                    (InputMap) defaults.get(prefix + "focusInputMap"));                    (InputMap) defaults.get(prefix + "focusInputMap"));
135        b.setRolloverEnabled(defaults.getBoolean(prefix + "rollover"));
136      b.setOpaque(true);      b.setOpaque(true);
137    }    }
138    
139    protected void uninstallDefaults(AbstractButton b)    protected void uninstallDefaults(AbstractButton b)
140    {    {
141        if (b.getFont() instanceof UIResource)
142          b.setFont(null);
143      b.setForeground(null);      b.setForeground(null);
144      b.setBackground(null);      b.setBackground(null);
145      b.setBorder(null);      b.setBorder(null);
# Line 264  public class BasicButtonUI extends Butto Line 269  public class BasicButtonUI extends Butto
269    
270      g.setFont(f);      g.setFont(f);
271    
272      SwingUtilities.calculateInnerArea(b, vr);      if (b.isBorderPainted())
273          SwingUtilities.calculateInnerArea(b, vr);
274        else
275          vr = SwingUtilities.getLocalBounds(b);
276      String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),      String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),
277                                                       b.getText(),                                                       b.getText(),
278                                                       currentIcon(b),                                                       currentIcon(b),
# Line 401  public class BasicButtonUI extends Butto Line 409  public class BasicButtonUI extends Butto
409    
410      if (b.isEnabled())      if (b.isEnabled())
411        {        {
412          g.setColor(b.getForeground());          g.setColor(b.getForeground());
413          g.drawString(text, textRect.x, textRect.y + fm.getAscent());          g.drawString(text, textRect.x, textRect.y + fm.getAscent());
414        }        }
415      else      else
416        {        {
417          g.setColor(b.getBackground().brighter());          UIDefaults defaults = UIManager.getLookAndFeelDefaults();
418          g.drawString(text, textRect.x, textRect.y + fm.getAscent());          String prefix = getPropertyPrefix();
419          g.setColor(b.getBackground().darker());          g.setColor(defaults.getColor(prefix + "disabledText"));
420          g.drawString(text, textRect.x + 1, textRect.y + fm.getAscent() + 1);          g.drawString(text, textRect.x, textRect.y + fm.getAscent());
421        }        }
422    }    }
423  }  }

Legend:
Removed from v.1.12.2.7  
changed lines
  Added in v.1.12.2.8

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