I have a feeling you can just invoke the actionListener by creating the object of that class, pretty simple.
I just am curious about how to close the current JFrame? I know how to use setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);, but that doesn't seem to work if I put that in for an actionListener for the apply button.
I appreciate the help.
and activates all of the actionListener's within the JFrame
Frames don't support ActionListener, so that doesn't make sense.
do I make it so that when I click a button like "apply", it automatically closes the current JFrame that is up
Ben Jass wrote: I know that Frames don't support actionListeners. I'm just saying that components that are within the JFrame hold actionListeners. Thank you for the second problem help.
Okay. So keep a list of the components which do have ActionListeners, and iterate through that list calling the ActionListener of each component. Although I can't conceive of a design in which closing a frame has the side effect of essentially pressing every button which happens to be in the frame. Is that really what you meant? I would approach the general requirement ("Do something when a JFrame is closed") in a more normal way, namely by providing the JFrame subclass with a "close" method which does the required things, and by having whatever closes the JFrame also call that method.
Or in your particular case, the method would be called "apply" or something sensible like that.
First setup screen:
Second time I bring up the setup screen after closing it once: