KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > kawa > models > Button


1 package gnu.kawa.models;
2 import java.awt.Color JavaDoc;
3
4 /** A model (data) for a clickable button. */
5
6 public class Button extends Model
7 {
8   boolean disabled;
9   String JavaDoc text;
10   Object JavaDoc action;
11   // These should be moved to "style" support
12
Color JavaDoc foreground;
13   Color JavaDoc background;
14   Object JavaDoc width;
15
16   public void makeView (Display display, Object JavaDoc where)
17   {
18     display.addButton(this, where);
19   }
20
21   public boolean isDisabled () { return disabled; }
22   public void setDisabled (boolean disabled) { this.disabled = disabled; }
23
24   public String JavaDoc getText () { return text; }
25   public void setText (String JavaDoc text)
26   {
27     this.text = text;
28     notifyListeners("text");
29   }
30
31   public Object JavaDoc getAction () { return action; }
32   public void setAction (Object JavaDoc action) { this.action = action; }
33
34   public Color JavaDoc getForeground () { return foreground; }
35   public void setForeground (Color JavaDoc fg)
36   {
37     foreground = fg;
38     notifyListeners("foreground");
39   }
40
41   public Color JavaDoc getBackground () { return background; }
42   public void setBackground (Color JavaDoc bg)
43   {
44     background = bg;
45     notifyListeners("background");
46   }
47 }
48
Popular Tags