/[classpath]/classpath/java/awt/Checkbox.java
ViewVC logotype

Diff of /classpath/java/awt/Checkbox.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mark, Sun Jan 13 15:45:15 2002 UTC revision 1.5 by tromey, Wed Jan 16 23:39:20 2002 UTC
# Line 1  Line 1 
1  /* Checkbox.java -- An AWT checkbox widget  /* Checkbox.java -- An AWT checkbox widget
2     Copyright (C) 1999 Free Software Foundation, Inc.     Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 34  import java.awt.event.ItemListener; Line 34  import java.awt.event.ItemListener;
34  import java.io.Serializable;  import java.io.Serializable;
35    
36  /**  /**
37    * This class implements a checkbox widget.   * This class implements a component which has an on/off state.  Two
38    *   * or more Checkboxes can be grouped by a CheckboxGroup.
39    * @author Aaron M. Renn (arenn@urbanophile.com)   *
40    */   * @author Aaron M. Renn (arenn@urbanophile.com)
41     * @author Tom Tromey <tromey@redhat.com>
42     */
43  public class Checkbox extends Component implements ItemSelectable, Serializable  public class Checkbox extends Component implements ItemSelectable, Serializable
44  {  {
45    
# Line 188  public synchronized void Line 190  public synchronized void
190  setLabel(String label)  setLabel(String label)
191  {  {
192    this.label = label;    this.label = label;
193      if (peer != null)
194    CheckboxPeer cp = (CheckboxPeer)getPeer();      {
195    if (cp != null)        CheckboxPeer cp = (CheckboxPeer) peer;
196      cp.setLabel(label);        cp.setLabel(label);
197        }
198  }  }
199    
200  /*************************************************************************/  /*************************************************************************/
# Line 220  public synchronized void Line 223  public synchronized void
223  setState(boolean state)  setState(boolean state)
224  {  {
225    this.state = state;    this.state = state;
226        if (peer != null)
227    CheckboxPeer cp = (CheckboxPeer)getPeer();      {
228    if (cp != null)        CheckboxPeer cp = (CheckboxPeer) peer;
229      cp.setState(state);        cp.setState (state);
230        }
231  }  }
232    
233  /*************************************************************************/  /*************************************************************************/
# Line 272  public synchronized void Line 276  public synchronized void
276  setCheckboxGroup(CheckboxGroup group)  setCheckboxGroup(CheckboxGroup group)
277  {  {
278    this.group = group;    this.group = group;
279        if (peer != null)
280    CheckboxPeer cp = (CheckboxPeer)getPeer();      {
281    if (cp != null)        CheckboxPeer cp = (CheckboxPeer) peer;
282      cp.setCheckboxGroup(group);        cp.setCheckboxGroup (group);
283        }
284  }  }
285    
286  /*************************************************************************/  /*************************************************************************/
# Line 286  setCheckboxGroup(CheckboxGroup group) Line 291  setCheckboxGroup(CheckboxGroup group)
291  public void  public void
292  addNotify()  addNotify()
293  {  {
294    if (getPeer() != null)    if (peer == null)
295      return;      peer = getToolkit ().createCheckbox (this);
296      super.addNotify ();
   setPeer((ComponentPeer)getToolkit().createCheckbox(this));  
297  }  }
298    
299  /*************************************************************************/  /*************************************************************************/
# Line 358  processItemEvent(ItemEvent event) Line 362  processItemEvent(ItemEvent event)
362  protected String  protected String
363  paramString()  paramString()
364  {  {
365    return(getClass().getName() + "(label=" + label + ",state=" + state + ")");    return(getClass().getName() + "[label=" + label + ",state=" + state
366             + ",group=" + group + "]");
367  }  }
368    
369  } // class Checkbox  } // class Checkbox
   

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26