01: package org.zaval.awt;
02:
03: import java.awt.*;
04:
05: public class IERadioButton extends BaseCheckbox {
06: public IERadioButton() {
07: }
08:
09: public IERadioButton(boolean state) {
10: this (null, state);
11: }
12:
13: public IERadioButton(String label, boolean state) {
14: setState(state);
15: setLabel(label);
16: }
17:
18: public void paint(Graphics g, int x, int y, int width, int height) {
19: int xx = x + width;
20: int yy = y + height;
21:
22: g.setColor(Color.lightGray);
23: if (isEnabled())
24: if (!mouse_down)
25: g.setColor(Color.white);
26:
27: g.fillOval(x, y, width, height);
28: g.setColor(Color.white);
29: g.drawLine(x + 4, yy - 1, xx - 5, yy - 1);
30: g.drawLine(xx - 1, y + 4, xx - 1, yy - 5);
31: g.drawLine(x + 2, yy - 2, xx - 3, yy - 2);
32: g.drawLine(xx - 2, y + 2, xx - 2, yy - 3);
33: g.setColor(Color.gray);
34: g.drawLine(x, y + 4, x, yy - 5);
35: g.drawLine(x + 1, y + 2, x + 1, yy - 3);
36: g.drawLine(x + 4, y, xx - 5, y);
37: g.drawLine(x + 2, y + 1, xx - 3, y + 1);
38: g.setColor(Color.black);
39: g.drawLine(x + 1, y + 4, x + 1, yy - 5);
40: g.drawLine(x + 2, y + 2, x + 2, y + 3);
41: g.drawLine(x + 2, yy - 4, x + 2, yy - 4);
42: g.drawLine(x + 3, y + 2, x + 3, y + 2);
43: g.drawLine(x + 4, y + 1, xx - 5, y + 1);
44: g.drawLine(xx - 4, y + 2, xx - 3, y + 2);
45: g.setColor(Color.lightGray);
46: g.drawLine(x + 2, yy - 3, x + 3, yy - 3);
47: g.drawLine(x + 4, yy - 2, xx - 5, yy - 2);
48: g.drawLine(xx - 4, yy - 3, xx - 3, yy - 3);
49: g.drawLine(xx - 3, yy - 4, xx - 3, yy - 4);
50: g.drawLine(xx - 2, y + 4, xx - 2, yy - 5);
51: g.drawLine(xx - 3, y + 3, xx - 3, y + 3);
52:
53: if (isEnabled())
54: g.setColor(Color.black);
55: else
56: g.setColor(Color.gray);
57:
58: if (state)
59: g.fillOval(x + 4, y + 4, 4, 4);
60: }
61:
62: protected boolean condition() {
63: if (getState())
64: return false;
65: return true;
66: }
67: }
|