It's not a secret anymore!
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Flexible Dialog Box" Watch "Flexible Dialog Box" New topic

Flexible Dialog Box

william brown

Joined: Jul 19, 2005
Posts: 16

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:
william brown

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.
I agree. Here's the link:
subject: Flexible Dialog Box
jQuery in Action, 3rd edition