Admittedly, this is a crappy fix, but it works! I added a mouse listener to the check box to listen for it being clicked. I also added a window listener so that the application doesn’t keep running when the user tried to exit by clicking the “X”.
//awt and swingcomponents
import javax.swing.*;
import java.awt.event.*;
class TestFrame extends JFrame
{
public TestFrame()
{
setTitle("TestFrame");
//add menubar to frame
setJMenuBar(createMenuBar());
//add panel with jcheckbox
addPanel();
addWindowListener(new WindowListener(){
public void windowOpened(WindowEvent arg0)
{}
public void windowClosing(WindowEvent arg0)
{
close();
}
public void windowClosed(WindowEvent arg0)
{}
public void windowIconified(WindowEvent arg0)
{}
public void windowDeiconified(WindowEvent arg0)
{}
public void windowActivated(WindowEvent arg0)
{}
public void windowDeactivated(WindowEvent arg0)
{}
});
//start frame maximized
setExtendedState(JFrame.MAXIMIZED_BOTH);
setVisible(true);
}
public void addPanel ()
{
JPanel test = new JPanel ();
JCheckBox click = new JCheckBox ("click me");
test.add(click);
add(test);
}
//creates the menubar
public JMenuBar createMenuBar ()
{
JMenuBar mb = new JMenuBar ();
//create the menu file
JMenu file = new JMenu ("File");
JMenuItem quit = new JMenuItem ("Quit");
quit.addActionListener(new ActionListener(){
public void actionPerformed (ActionEvent ae){ close(); }
});
//add menuitems to menu file
file.add(quit);
//create the menu options
JMenu options = new JMenu ("Options");
//menuitems of het menu
final JCheckBox wire = new JCheckBox ("Wireframe Models");
wire.addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent arg0)
{
wire.setSelected(!wire.isSelected());
/* ActionEvent Code Here */
}
public void mousePressed(MouseEvent arg0)
{}
public void mouseReleased(MouseEvent arg0)
{}
public void mouseEntered(MouseEvent arg0)
{}
public void mouseExited(MouseEvent arg0)
{}
});
final JCheckBox shadows = new JCheckBox ("Shadows");
shadows.setSelected(true);
shadows.addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent arg0)
{
shadows.setSelected(!shadow.isSelected());
/* ActionEvent Code Here */
}
public void mousePressed(MouseEvent arg0)
{}
public void mouseReleased(MouseEvent arg0)
{}
public void mouseEntered(MouseEvent arg0)
{}
public void mouseExited(MouseEvent arg0)
{}
});
//add menuitems to menu file
options.add(wire);
options.add(shadows);
//add menus to menubar
mb.add(file);
mb.add(options);
return mb;
}
//displays dialog which ask to close
public void close ()
{
if (JOptionPane.showConfirmDialog(null, "Do you really want to close",
"Close ModelLoader",
JOptionPane.YES_NO_OPTION)
== JOptionPane.YES_OPTION)
System.exit(0);
}
//main method
public static void main(String[] args) { new TestFrame(); }
}

