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 |
|
|
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 |
|
|
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 |
/*************************************************************************/ |
/*************************************************************************/ |
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 |
/*************************************************************************/ |
/*************************************************************************/ |
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 |
/*************************************************************************/ |
/*************************************************************************/ |
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 |
/*************************************************************************/ |
/*************************************************************************/ |
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 |
|
|
|