Need help with a menu button in a game
hello, i am working on a video game for my class. i have an option menu that lets you select a character, then you hit the play button and it goes into the game. the problem is if i don't select a character i can still hit play, but then there is no character in the game. i am having trouble writing the correct if statements so that i cannot hit play until i have selected a character here is the code, the play button is the (opt.play) and the charcters are (opt.jb1-jb3) they are radio buttons.
Code:
}
public void actionPerformed(ActionEvent e)
{
Object obj = e.getSource();
if (obj==set.info)
{
remove(set);
add(ins);
validate();
repaint();
}
if (obj==set.play)
{
remove(set);
add(opt);
validate();
repaint();
}
if (obj==set.score)
{
remove(set);
add(sco);
validate();
repaint();
}
if(obj == opt.play)
{
remove(opt);
add(gam);
validate();
repaint();
}
if(obj ==ins.back)
{
remove(ins);
add(set);
validate();
repaint();
}
if(obj==sco.back)
{
remove(sco);
add(set);
validate();
repaint();
}
if(obj==gam.back)
{
remove(gam);
add(set);
validate();
repaint();
}
if(obj==opt.back)
{
remove(opt);
add(set);
validate();
repaint();
}
if(obj==opt.jb1)
{
gam.width=50;
gam.height=34;
gam.b5.setIcon(imagelogo);
}
if(obj==opt.jb2)
{
gam.width=50;
gam.height=83;
gam.b5.setIcon(imagelion);
}
if(obj==opt.jb3)
{
gam.width=50;
gam.height=118;
gam.b5.setIcon(imagejoe);
}