01: package gnu.kawa.models;
02:
03: import java.awt.Color;
04:
05: /** A model (data) for a clickable button. */
06:
07: public class Button extends Model {
08: boolean disabled;
09: String text;
10: Object action;
11: // These should be moved to "style" support
12: Color foreground;
13: Color background;
14: Object width;
15:
16: public void makeView(Display display, Object where) {
17: display.addButton(this , where);
18: }
19:
20: public boolean isDisabled() {
21: return disabled;
22: }
23:
24: public void setDisabled(boolean disabled) {
25: this .disabled = disabled;
26: }
27:
28: public String getText() {
29: return text;
30: }
31:
32: public void setText(String text) {
33: this .text = text;
34: notifyListeners("text");
35: }
36:
37: public Object getAction() {
38: return action;
39: }
40:
41: public void setAction(Object action) {
42: this .action = action;
43: }
44:
45: public Color getForeground() {
46: return foreground;
47: }
48:
49: public void setForeground(Color fg) {
50: foreground = fg;
51: notifyListeners("foreground");
52: }
53:
54: public Color getBackground() {
55: return background;
56: }
57:
58: public void setBackground(Color bg) {
59: background = bg;
60: notifyListeners("background");
61: }
62: }
|