FSF GCC merge 02/23/03
[official-gcc.git] / libjava / javax / swing / plaf / basic / BasicToggleButtonUI.java
blob507d61732e47e3fb664f637e15c385a85d1effd6
1 package javax.swing.plaf.basic;
3 import javax.swing.*;
4 import javax.swing.plaf.*;
5 import java.awt.*;
8 public class BasicToggleButtonUI extends BasicButtonUI
11 public static ComponentUI createUI(final JComponent c) {
12 return new BasicToggleButtonUI();
16 public void installUI(final JComponent c) {
17 super.installUI(c);
20 public Dimension getPreferredSize(JComponent c)
22 AbstractButton b = (AbstractButton)c;
23 Dimension d = BasicGraphicsUtils.getPreferredSize(b,
24 gap,
25 b.getText(),
26 b.getIcon(),
27 b.getVerticalAlignment(),
28 b.getHorizontalAlignment(),
29 b.getHorizontalTextPosition(),
30 b.getVerticalTextPosition());
32 //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
33 return d;
36 protected void paintFocus(Graphics g,
37 JComponent c,
38 Rectangle vr,
39 Rectangle tr,
40 Rectangle ir)
44 protected void paintIcon(Graphics g,
45 JComponent c,
46 Rectangle iconRect)
50 protected void paintButtonPressed(Graphics g,
51 JComponent b)
53 Dimension size = b.getSize();
55 g.setColor(pressedBackgroundColor);
56 g.fillRect(1,1,size.width-2, size.height-2);
60 protected void paintButtonNormal(Graphics g,
61 JComponent b)
63 Dimension size = b.getSize();
65 g.setColor(normalBackgroundColor);
66 g.fillRect(1,1,size.width-2, size.height-2);
69 protected void paintText(Graphics g,
70 JComponent c,
71 Rectangle textRect,
72 String text)
74 // AbstractButton b = (AbstractButton) c;
76 // System.out.println("drawing string: " + text + ", at:" + textRect);
78 g.setColor(textColor);
80 BasicGraphicsUtils.drawString(g,
81 text,
82 0,
83 textRect.x,
84 textRect.y);