1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
package javax.swing.plaf.basic;
import javax.swing.*;
import javax.swing.plaf.*;
import java.awt.*;
public class BasicCheckBoxUI extends BasicRadioButtonUI
{
public static ComponentUI createUI(final JComponent c) {
return new BasicCheckBoxUI();
}
public void installUI(final JComponent c) {
super.installUI(c);
}
public Dimension getPreferredSize(JComponent c)
{
AbstractButton b = (AbstractButton)c;
Dimension d = BasicGraphicsUtils.getPreferredSize(b,
gap,
b.getText(),
b.getIcon(),
b.getVerticalAlignment(),
b.getHorizontalAlignment(),
b.getHorizontalTextPosition(),
b.getVerticalTextPosition());
//System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
return d;
}
protected void paintFocus(Graphics g,
JComponent c,
Rectangle vr,
Rectangle tr,
Rectangle ir)
{
}
protected void paintIcon(Graphics g,
JComponent c,
Rectangle iconRect)
{
}
protected void paintButtonPressed(Graphics g,
JComponent b)
{
Dimension size = b.getSize();
g.setColor(pressedBackgroundColor);
g.fillRect(1,1,size.width-2, size.height-2);
}
protected void paintButtonNormal(Graphics g,
JComponent b)
{
Dimension size = b.getSize();
g.setColor(normalBackgroundColor);
g.fillRect(1,1,size.width-2, size.height-2);
}
protected void paintText(Graphics g,
JComponent c,
Rectangle textRect,
String text)
{
// AbstractButton b = (AbstractButton) c;
// System.out.println("drawing string: " + text + ", at:" + textRect);
g.setColor(textColor);
BasicGraphicsUtils.drawString(g,
text,
0,
textRect.x,
textRect.y);
}
}
|