• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Flexible Dialog Box

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

Thank you
 
Ranch Hand
Posts: 580
  • 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.
 
No, tomorrow we rule the world! With this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic