home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / java / awt / Button.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  1.3 KB  |  38 lines

  1. package java.awt;
  2.  
  3. import java.awt.peer.ButtonPeer;
  4.  
  5. public class Button extends Component {
  6.    String label;
  7.  
  8.    public Button() {
  9.       this("");
  10.    }
  11.  
  12.    public Button(String label) {
  13.       this.label = label;
  14.    }
  15.  
  16.    public synchronized void addNotify() {
  17.       super.peer = ((Component)this).getToolkit().createButton(this);
  18.       super.addNotify();
  19.    }
  20.  
  21.    public String getLabel() {
  22.       return this.label;
  23.    }
  24.  
  25.    public void setLabel(String label) {
  26.       this.label = label;
  27.       ButtonPeer peer = (ButtonPeer)super.peer;
  28.       if (peer != null) {
  29.          peer.setLabel(label);
  30.       }
  31.  
  32.    }
  33.  
  34.    protected String paramString() {
  35.       return super.paramString() + ",label=" + this.label;
  36.    }
  37. }
  38.