PDA

View Full Version : [Java] GUI & Radio Buttons



Ishana
July 24th, 2010, 16:03
Hey,

I have this error i used

Jform Designer to make it



public void GUI(){

ButtonGroup group = new ButtonGroup();
group.add(PowerChop);
group.add(Banking);
// Component - DO NOT MODIFY
label1 = new JLabel();
Banking = new JRadioButton();
PowerChop = new JRadioButton();
button1 = new JButton();
CellConstraints cc = new CellConstraints();
//======== this ========
setLayout(new FormLayout(
"7*(default, $lcgap), default",
"3*(default, $lgap), default"));
//---- label1 ----
label1.setText("Bank? or Powerchop?");
add(label1, cc.xy(3, 1));
//---- Banking ----
Banking.setText("Bank");
add(Banking, cc.xy(3, 3));
//---- PowerChop ----
PowerChop.setText("PowerChop");
add(PowerChop, cc.xy(3, 5));
//---- button1 ----
button1.setText("Start");
add(button1, cc.xy(3, 7));
//End of component initialization
}


Error i get it is



symbol : class CellConstraints
location: class MapleFTP
CellConstraints cc = new CellConstraints();
^
Scripts\MapleFTP.java:107: cannot find symbol
symbol : class CellConstraints
location: class MapleFTP
CellConstraints cc = new CellConstraints();
^
Scripts\MapleFTP.java:109: cannot find symbol
symbol : class FormLayout
location: class MapleFTP
setLayout(new FormLayout(



Now for radio buttons how can i make that it checks if it is checked :confused:


Edit : Well i used google and found that i must import com.jgoodies.forms.layout.CellConstraints but it does not work =(

Trey
July 24th, 2010, 16:12
You probably have to download the library (the .jar file) and include it in your projects libraries. As for the button toggling, use the isSelected and setSelected methods.