GUI Troubles

I have a GUI Program. I have my main JFrame for the program and I also have another JFrame that shows up when I click a button.

In this second window I have two JPanels, both of which are designed in their own classes as objects of the class.

In the first JPanel, I have a check box, and in the second JPanel I have some buttons.

I'm having trouble trying to detect if the check box is checked or not when I click the buttons. Any help is appreciated.

[480 byte] By [imdandmana] at [2007-11-27 9:22:26]
# 1
Sorry I forgot to post this, but when I close the second JFrame, it closes my entire program instead of going back to the first JFrame
imdandmana at 2007-7-12 22:16:52 > top of Java-index,Java Essentials,Java Programming...
# 2
> Sorry I forgot to post this, but when I close the> second JFrame, it closes my entire program instead of> going back to the first JFrameyourSecondFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
CaptainMorgan08a at 2007-7-12 22:16:52 > top of Java-index,Java Essentials,Java Programming...
# 3

> I'm having trouble trying to detect if the check box

> is checked or not when I click the buttons. Any help

> is appreciated.

It sounds like you should pass a reference of the checkbox-JPanel to the button-JPanel.

JPanelWithCheckBoxes asdf = new JPanelWithCheckBoxes();

JPanelWithButtons fdsa = new JPanelWithButtons(asdf);

Make sense?

CaptainMorgan08a at 2007-7-12 22:16:52 > top of Java-index,Java Essentials,Java Programming...
# 4
Excellent help from everyone. My issues are resolved!I didn't add the reference to the constructor, but I added it to another method. Either way, I got what you were saying and it worked!Thanks.
imdandmana at 2007-7-12 22:16:52 > top of Java-index,Java Essentials,Java Programming...