/[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.4 by gnu_andrew, Wed Jan 26 02:30:49 2005 UTC revision 1.12.2.5 by gnu_andrew, Thu Apr 28 23:00:14 2005 UTC
# Line 107  public class BasicButtonUI extends Butto Line 107  public class BasicButtonUI extends Butto
107      textShiftOffset = defaultTextShiftOffset;      textShiftOffset = defaultTextShiftOffset;
108    }    }
109    
110      /**
111       * Returns the prefix for the UI defaults property for this UI class.
112       * This is 'Button' for this class.
113       *
114       * @return the prefix for the UI defaults property
115       */
116      protected String getPropertyPrefix()
117      {
118        return "Button";
119      }
120    
121    protected void installDefaults(AbstractButton b)    protected void installDefaults(AbstractButton b)
122    {    {
123      UIDefaults defaults = UIManager.getLookAndFeelDefaults();      UIDefaults defaults = UIManager.getLookAndFeelDefaults();
124      focusColor = defaults.getColor("Button.focus");      String prefix = getPropertyPrefix();
125      b.setForeground(defaults.getColor("Button.foreground"));      focusColor = defaults.getColor(prefix + ".focus");
126      b.setBackground(defaults.getColor("Button.background"));      b.setForeground(defaults.getColor(prefix + ".foreground"));
127      b.setMargin(defaults.getInsets("Button.margin"));      b.setBackground(defaults.getColor(prefix + ".background"));
128      b.setBorder(defaults.getBorder("Button.border"));      b.setMargin(defaults.getInsets(prefix + ".margin"));
129      b.setIconTextGap(defaults.getInt("Button.textIconGap"));      b.setBorder(defaults.getBorder(prefix + ".border"));
130        b.setIconTextGap(defaults.getInt(prefix + ".textIconGap"));
131      b.setInputMap(JComponent.WHEN_FOCUSED,      b.setInputMap(JComponent.WHEN_FOCUSED,
132                    (InputMap) defaults.get("Button.focusInputMap"));                    (InputMap) defaults.get(prefix + ".focusInputMap"));
133      b.setOpaque(true);      b.setOpaque(true);
134    }    }
135    
# Line 247  public class BasicButtonUI extends Butto Line 259  public class BasicButtonUI extends Butto
259      Rectangle tr = new Rectangle();      Rectangle tr = new Rectangle();
260      Rectangle ir = new Rectangle();      Rectangle ir = new Rectangle();
261      Rectangle vr = new Rectangle();      Rectangle vr = new Rectangle();
     Rectangle br = new Rectangle();  
262    
263      Font f = c.getFont();      Font f = c.getFont();
264    
265      g.setFont(f);      g.setFont(f);
266    
267      SwingUtilities.calculateInnerArea(b, br);      SwingUtilities.calculateInnerArea(b, vr);
     SwingUtilities.calculateInsetArea(br, b.getMargin(), vr);      
268      String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),      String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),
269                                                       b.getText(),                                                       b.getText(),
270                                                       currentIcon(b),                                                       currentIcon(b),
# Line 270  public class BasicButtonUI extends Butto Line 280  public class BasicButtonUI extends Butto
280          || b.isSelected())          || b.isSelected())
281        paintButtonPressed(g, b);        paintButtonPressed(g, b);
282      else      else
283        paintButtonNormal(g, br, c);        paintButtonNormal(g, vr, c);
284                    
285      paintIcon(g, c, ir);      paintIcon(g, c, ir);
286      if (text != null)      if (text != null)

Legend:
Removed from v.1.12.2.4  
changed lines
  Added in v.1.12.2.5

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