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 JOptionPane buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane buttons" Watch "JOptionPane buttons" New topic
Author

JOptionPane buttons

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
I have a JOptionPane that contains a JPanel which has a text field on it.
When the user hits enter after they key into the text field, it should pull up some db info. However, when they hit enter, the option pane closes, rather than staying up. How can I tell my JOptionPane not to close unless the user actually pressed the OK button or closed the dialog ('X') with their mouse?

Thanks in advance!
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
When the JOptionPane showXXX method returns the dialog closes. You can open another one each time you get input and want to continue (shown below). Or, instead of using JOptionPane you could make a JDialog with your components and control it from within your event code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JOptionPane buttons
 
Similar Threads
How to remove selection of initialValue in JOptionPane
Submitting a form on pressing Enter key
JOptionPane Errors
JTextField question
validations coding..