File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How to make a popup Window, not Menu Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "How to make a popup Window, not Menu" Watch "How to make a popup Window, not Menu" New topic
Author

How to make a popup Window, not Menu

Bigglesworth Naruki
Greenhorn

Joined: Nov 05, 2001
Posts: 14
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?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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.

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to make a popup Window, not Menu
 
Similar Threads
Close main window from popup window
Popup form, parent form
Check if popup window is already open from parent window?
reload openr window after calling servlet
popup window