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

Swing is my Nemesis

Vanessa Astle
Ranch Hand

Joined: May 08, 2007
Posts: 37
Is it possible to add more than one JOptionPane to a dialog?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11155
    
  16

We do have a forum specifically devoted to Swing and AWT. I am going to move this to that forum, where you will get a better response.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Vanessa Astle
Ranch Hand

Joined: May 08, 2007
Posts: 37
Thanks!!
Darrin Cartwright
Ranch Hand

Joined: Dec 27, 2002
Posts: 107
Hi Vanessa,

I'm not sure what you are asking. The JOptionPane class is usually used to create a dialog. Do you mean is is possible to display more than one at a time?
What exactly are you wanting to accomplish?

Darrin


Life is good on the Ponderosa,<br />but mind where you step.
Vanessa Astle
Ranch Hand

Joined: May 08, 2007
Posts: 37
I'm trying to create a popup where a user has to choose options from a few different fields.

According to "The Definitive Guide to Java Swing" and the numerous other textbooks on swing that I have piled around me, a JOptionPane is "a special class for creating a panel to be placed in a pop-up window". And a Dialog is "a class that represents the standard pop-up window". Yet, in Java JOptionPane's seem sort of interchangeable with dialogs. I am being told that I can place a JOptionPane "in" a JDialog or JInternal Frame by making a reference of those types and assigning them to the JOptionPane object.

I just wanted an easier way to make a popup. I really didn't want to have to deal with layouts, and the JOptionPane class seemed like an ideal way to get a readymade panel, insert it into some sort of frame/dialog popup, and go from there!

Any insight would be fabulous! Thanks so much!
Darrin Cartwright
Ranch Hand

Joined: Dec 27, 2002
Posts: 107
Creating a custom JOptionPane to insert into a JDialog will probably be more trouble than just creating a JDialog to begin with. You will also be limited by the return values possible, although an array of String is always useful.

Darrin
Vanessa Astle
Ranch Hand

Joined: May 08, 2007
Posts: 37
Alright, I decided to use the GridBagLayout class and it helped me out with the layout quite a bit. Thanks for your help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Swing is my Nemesis