Ask Questions?

View Latest Questions



The Dialog boxes
Posted on: July 24, 2006 at 12:00 AM
There are several ways to build dialog boxes.

Java: Dialogs

There are several ways to build dialog boxes:

JOptionPane - Simple Dialogs
This is a very easy way (one statement) to build simple dialogs. Usually this, JFileChooser, and maybe JColorChooser are the only dialog classes that you need.
This will create and control a standard file chooser dialog.
You can call one static method (Color.showDialog(. . .)) to display a dialog that lets the user choose a color, or you can add listeners to make a more complicated dialog interaction, or you can use this class to create a color chooser pane.
JProgressBar and ProgressMonitor
These can be used to display the progress during a long task.
This can be used for building dialogs that are too complicated for JOptionPane.

Dialogs are attached to window (frame)

Every dialog is attached to a window (frame). When the window in iconified, the dialog will automatically disappear, and it will automatically reappear when the window is deiconified. When the window is destroyed, the dialog will disappear.

Dialogs are usually modal

When a dialog in active, input to other parts of the graphical user interface will be blocked. This kind of dialog is called a modal dialog. If you want a dialog which is modeless (allows interaction with other windows), you must use the JDialog class.


A date picker is likely for Java 6.


Copyleft 2005 Fred Swartz MIT License