Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing is my Nemesis

 
Vanessa Astle
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to add more than one JOptionPane to a dialog?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12083
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vanessa Astle
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!!
 
Darrin Cartwright
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vanessa Astle
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright, I decided to use the GridBagLayout class and it helped me out with the layout quite a bit. Thanks for your help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic