next up previous
Next: JOptionPane constants Up: Dialogs Previous: A simple dialog

Option dialogs -- JOptionPane

Across many applications we will want have dialogs that convey a certain message.

We may want to

The JOptionPane dialog offers a is fairly consistent (look-and-feel dependent) set of functional dialogs

Each dialog possess up to 4 components:

icon area
-- displays an icon.
button area
-- populated with one or more buttons (Yes, No, OK, Cancel, and so on) according to an option type specified by the developer
message area
-- shows a simple text string as a message.
input area
-- content is controlled by the setWantsInput() method allowing the presence of a data entry field that requires the user to enter some text.

There are four dialog types which can be further enhanced by by a messageType parameter in the show...Dialog() methods.

They each have different functionality and should be used in the most applicable fashion only. They are characterised by a slightly different appearance -- buttons available, input possible etc.

The four dialog types are:

Message Dialog
-- displays information to the user, includes a single OK button

Error Message Dialog

Confirm Dialog
-- Asks the user to confirm some information, includes buttons such as Yes and No, or OK and Cancel.

Information Confirm Dialog

Question Confirm Dialog

Plain Message Confirm Dialog

Input Dialog
-- Provides some way (JTextField,JComboBox, JList) for entry of data, always includes an OK and Cancel button.

Warning Input Dialog

Option Dialog
-- general programmer defined dialog, can contain any set of buttons

Note that are several permutation of the predefined style of dialogs:

The messageType and other dialog properties are controlled by JOptionPane constants.



 
next up previous
Next: JOptionPane constants Up: Dialogs Previous: A simple dialog
Dave Marshall
4/14/1999