Home www.python.org
Download Documentation
Home
Overview
License
Jython 2.0
Jython 2.1
Installing
JVM Compatibility
 
Applets
Demos
ButtonDemo
CheckboxDemo
ChoiceDemo
LabelDemo
ListDemo
CoordinatesDemo
ConvertDemo
 
Applet Problems
Here's what to do
Other applet issues
 
Email Us
jython-dev@lists.sourceforge.net
 
 
SourceForge Logo
  

Using Checkboxes

This example shows how to use Checkboxes from Jython.

Something has gone wrong loading this applet.

The complete source code for this example is included below.


from java import awt, applet class CheckboxDemo(applet.Applet): def init(self): cb1 = awt.Checkbox('Checkbox 1') cb2 = awt.Checkbox('Checkbox 2') cb3 = awt.Checkbox('Checkbox 3', state=1) p1 = awt.Panel(layout=awt.FlowLayout()) p1.add(cb1) p1.add(cb2) p1.add(cb3) cbg = awt.CheckboxGroup() cb4 = awt.Checkbox('Checkbox 4', cbg, 0) cb5 = awt.Checkbox('Checkbox 5', cbg, 0) cb6 = awt.Checkbox('Checkbox 6', cbg, 0) p2 = awt.Panel(layout=awt.FlowLayout()) p2.add(cb4) p2.add(cb5) p2.add(cb6) self.setLayout(awt.GridLayout(0, 2)) self.add(p1) self.add(p2) self.validate()
The first panel (p1) holds three checkboxes that are not grouped together in any way. The third checkbox is initially set to checked using its state property as a keyword argument. The second panel holds a group of three checkboxes that all belong to the same checkbox group.