Java Reference
In-Depth Information
TABLE 12-11 Some Constructors and Methods of the class JRadioButton (continued)
public JRadioButton(Icon icon, boolean selected)
//Creates a radio button with the specified
//icon and selection state, but with no label.
//Example:JRadioButton myJRadioButton =
//
new JRadioButton(anIcon, true);
//
myJRadioButton points to the selected radio button
//
with the icon "anIcon".
public JRadioButton(String text)
//Creates an unselected radio button with the
//specified text as the label.
//Example: JRadioButton myJRadioButton =
//
new JRadioButton("Box");
//
myJRadioButton points to the unselected radio button
//
with the label "Box".
public JRadioButton(String text, boolean selected)
//Creates a radio button with the specified
//text as the label and selection state.
//Example: JRadioButton myJRadioButton =
//
new JRadioButton("Box", false);
//
myJRadioButton points to the unselected radio
//
button with the label "Box".
public JRadioButton(String text, Icon icon)
//Creates a radio button with the specified
//icon and the specified text as the label.
//Example: RadioButton myJRadioButton =
//
new JRadioButton("Box", anIcon);
//
myJRadioButton points to the unselected radio button
//
with the label "Box" and the icon "anIcon".
public JRadioButton(String text, Icon icon, boolean selected)
//Creates a radio button with the specified icon and
//selection state, and with the specified text as the label
//Example: JRadioButton myJRadioButton =
//
new JRadioButton("Box", anIcon, true);
//
myJRadioButton points to the selected radio button
//
with the label "Box" and the icon "anIcon".
public boolean isSelected()
//This method is inherited from the AbstractButton class
//and is used to retrieve the state of a button.
//Example: if (myJRadioButton.isSelected() == true)
//
The "if" block will be executed provided
//
myJRadioButton is checked.
public boolean setSelected( boolean b)
//This method is inherited from the AbstractButton class
//and is used to set the state of a button.
//Example: myJRadioButton.setSelected(true);
//
myJRadioButton gets checked.
Search WWH ::




Custom Search