File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Flexible Dialog Box

 
william brown
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 410
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah. You are right. I should use JDialog.

Thank you
 
Don Kiddick
Ranch Hand
Posts: 580
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic