File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Gathering input data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Gathering input data" Watch "Gathering input data" New topic

Gathering input data

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 808

I would like to write a kind of GUI using SWING.
I want to gather some input data from user. I have to use a couple of frames to gather this information.
What's the best practice to do this?

What about this:
1). frame1.isVisible(true);
2). user provides data and then clicks next "button"
//next and next

Is it a good solution?

pete stein

Joined: Feb 23, 2007
Posts: 1561
How do most programs you use gather this information? Try to emulate those programs. Most don't have frames swapping with each other. Some have swapping panels (think CardLayout). Some use tabbed panels (think JTabbedPane), some use modal dialogs (think JOptionPane or JDialog).
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10817

I personally feel JTabbedPane is not an intuitive component to gather multiple input from the user. YMMV.
Card layouts will help you with Wizard king of UI.
JOptionPane has built in showInputDialog which can be heavily customized. I would prefer it over JDialog as it saves me the hassle of creating and controlling the dialog.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: Gathering input data
It's not a secret anymore!