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