I want to put a button on my panel that, when pressed, will generate a new modal window that I can customize just like a regular application JFrame. I've looked at the Java Sun tutorials and the API docs, but for some reason I am just not seeing how to do this. The only other requirement is that I can retrieve/set the values on the popup window's components even when it's not visible. Surely this is simple, right?
The class you're looking for is JDialog. You can lay out components on a JDialog just like a JFrame. You can also access the values of fields on your JDialog if you create it in your current class, or if you create it in another class and add methods to return the values. To make it launch on a button click, all you have to do is create the dialog beforehand, then add an actionListener to the button that makes the JDialog visible.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad: