Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Leon Hansen   on Jan 13 In Java Category.

  
Question Answered By: Anthony Smith   on Jan 13

1. Create an instance of ButtonGroup.
2. Create instances of JRadioButton.
3. Add each JRadioButton instance to the ButtonGroup instance.

// Create the button group.
bg = new ButtonGroup();
// Create the radio buttons. Select the first one.
jrbFrench = new JRadioButton("French", true);
jrbGerman = new JRadioButton("German");
jrbChinese = new JRadioButton("Chinese");
// Add the radio buttons to the group.
bg.add(jrbFrench);
bg.add(jrbGerman);
bg.add(jrbChinese);

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on GUI problem Or get search suggestion and latest updates.


Tagged: