aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Flexible Dialog Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Flexible Dialog Box" Watch "Flexible Dialog Box" New topic
Author

Flexible Dialog Box

william brown
Greenhorn

Joined: Jul 19, 2005
Posts: 16
Hi

I plan to create a modal dialog box that can accept few input parameters.

Maybe like a frame that can contains all sorts of components like tabbedPane, Buttons, etc BUT acts like a dialog box, means that I have to click a button in the main frame before the "dialog box" can appear and I have to click either "OK" or "Cancel" to close the "dialog box" + (it is modal).

I learned that JOptionPane.showInputDialog can just accept 1 line of input argument as String. I dont want user to key in all the input parameters in one string of text. And I dont want to have few dialog boxes in sucession in order to accept few input parameters from the user.


I hope to find a modal dialog box where I can organise the position of any of the labels and textField and accepts various kinds of input parameters.


Any suggestion?

Thank you.
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
Just use the JDialog class - maybe extending it but I don't think you will need to. There is a helpful section in the Java Tutorial about this:

http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html
william brown
Greenhorn

Joined: Jul 19, 2005
Posts: 16
Yeah. You are right. I should use JDialog.

Thank you
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
No need to build anything yourself. You can use the constructor :
public static String showInputDialog(Component parentComponent, Object message)

You can supply a JPanel for the parameter message. This can have numerous textfields, checkfields etc on it. When the method returns query the values of these fields.

hth, D.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Flexible Dialog Box