• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CHECKBOXGROUP.. newbie here :(

 
kat Vicap
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i cant get this thing to compile. i'm still stucked in this GUI part.



the error says that it cannot find symbol for the checkboxgroup()
help..
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CheckboxGroup is with a lowercase b. Once you fix that you'll get another 3 compiler errors though, since JCheckBox (Swing) is not compatible with CheckboxGroup (AWT).

It appears you want to use a mutually exclusive selection: only one of the options. In that case, use a ButtonGroup with JRadioButton, not JCheckBox. Replace JCheckBox with JRadioButton and CheckboxGroup with ButtonGroup:
 
kat Vicap
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
Brian Cole
Author
Ranch Hand
Posts: 908
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:use a ButtonGroup with JRadioButton, not JCheckBox


FYI, I'm pretty sure that ButtonGroup works fine with JCheckBox and JToggleButton in addition to JRadioButton.
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should as it works with AbstractButton, but visually a JRadioButton is probably better here. A JCheckBox or JToggleButton doesn't say "only one option" like JRadioButton does.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic