This example shows how to use Checkboxes from JPython.
The complete source code for this example is included below.
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.
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()