FSF GCC merge 02/23/03
[official-gcc.git] / libjava / javax / swing / plaf / basic / BasicCheckBoxUI.java
blob1a84b1faa2c2daaecc00421834cad65d7f9ceea6
1 package javax.swing.plaf.basic;
3 import javax.swing.*;
4 import javax.swing.plaf.*;
5 import java.awt.*;
8 public class BasicCheckBoxUI extends BasicRadioButtonUI
9 {
10 public static ComponentUI createUI(final JComponent c) {
11 return new BasicCheckBoxUI();
15 public void installUI(final JComponent c) {
16 super.installUI(c);
19 public Dimension getPreferredSize(JComponent c)
21 AbstractButton b = (AbstractButton)c;
22 Dimension d = BasicGraphicsUtils.getPreferredSize(b,
23 gap,
24 b.getText(),
25 b.getIcon(),
26 b.getVerticalAlignment(),
27 b.getHorizontalAlignment(),
28 b.getHorizontalTextPosition(),
29 b.getVerticalTextPosition());
31 //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
32 return d;
35 protected void paintFocus(Graphics g,
36 JComponent c,
37 Rectangle vr,
38 Rectangle tr,
39 Rectangle ir)
43 protected void paintIcon(Graphics g,
44 JComponent c,
45 Rectangle iconRect)
49 protected void paintButtonPressed(Graphics g,
50 JComponent b)
52 Dimension size = b.getSize();
54 g.setColor(pressedBackgroundColor);
55 g.fillRect(1,1,size.width-2, size.height-2);
59 protected void paintButtonNormal(Graphics g,
60 JComponent b)
62 Dimension size = b.getSize();
64 g.setColor(normalBackgroundColor);
65 g.fillRect(1,1,size.width-2, size.height-2);
68 protected void paintText(Graphics g,
69 JComponent c,
70 Rectangle textRect,
71 String text)
73 // AbstractButton b = (AbstractButton) c;
75 // System.out.println("drawing string: " + text + ", at:" + textRect);
77 g.setColor(textColor);
78 BasicGraphicsUtils.drawString(g,
79 text,
81 textRect.x,
82 textRect.y);