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 creating my own dialog box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "creating my own dialog box" Watch "creating my own dialog box" New topic
Author

creating my own dialog box

Edmund Castermund
Ranch Hand

Joined: May 09, 2007
Posts: 85
Hi,
i'm creating a simple window that allows the user to enter some text...the problem I'm having is that I want the rest of the application to wait until the user has entered the data before continuing to process data.

For example, I have a similar function in the app that uses a JFileChooser; in that case, the file chooser dialog apppears, when the user selects the files they want, an object is created and then methods are executed, but not until the user has selected the files. In the dialog I'm writing, that doesn't happen; the application keeps right on going before the user can enter the information the dialog; the object is created with a null value, and of course, screws up the processing I want to do.

When using the JFileChooser, I have an if block that says something like

but I'm having trouble replicating that for my own dialog....

here's the relevant code that creates the dialog...
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

What you need is a modal dialog.
Check out JOptionPane It provides various convenient showXXXDialog methods which you can use.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Edmund Castermund
Ranch Hand

Joined: May 09, 2007
Posts: 85
that did it...I made the window extend JDialog, and set modal to true
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating my own dialog box