These four examples on JCheckBox and JRadioButton which cover almost all of their methods and constructors gives you a deeper understanding of them.
A JCheckBox lies on a single principle,
checked/unchecked. This component is mostly used in when we are checking
multiple items, for example in Job search site, you might have
undergone this where you select multiple skills, a check box is mostly
used.
- JCheckBox Kickstart Example for Starters
- How to give JCheckBox a Button feel?
- How to add JCheckBox to JButton?
JRadioButton is also based on the same principle as that of the JCheckBox. But the difference is that a JRadioButton is typically used when the user has to choose only one among the many items in a group. For instance, you can use it for Male/Female, the user has to select either of it, but not both. In AWT, you don't have specified class for JRadioButton as here.
Note: JButton, JToggleButton, JCheckBox and JRadioButton are all sub-classes of AbstractButton.
No comments:
Post a Comment