javax.swing.JOptionPane - Creating and Displaying Option Dialog Boxes

This section describes some static methods in the JOptionPane class that can be used to create and display different types of option dialog boxes.

javax.swing.JOptionPane - A Swing class that allows to create and display option dialog boxes. Interesting methods of JOptionPane include:

All dialog boxes created with the JOptionPane class are modal, disabling all other user interface components on other frames. Each call of show*Dialog() method blocks the execution until the dialog box is closed.

All dialog boxes must be created with parent frame.

The message type of an option dialog box controls the icon used on the left side of the message text.

The option type of an option dialog box controls what option buttons to be displayed.

The option buttons can be customized with your own option strings.

Last update: 2014.

Table of Contents

 About This Book

 Introduction of Java Swing Package

 Graphics Environment of the Local System

 JFrame - Main Frame Class

 JLabel - Swing Label Class

 JButton - Swing Button Class

 JRadioButton - Swing Radio Button Class

 JTextField - Swing Text Field Class

 Menu Bar, Menus, Menu Items and Listeners

 Creating Internal Frames inside the Main Frame

 Layout of Components in a Container

 LookAndFeel and UIManager

Option Dialog Boxes

javax.swing.JOptionPane - Creating and Displaying Option Dialog Boxes

 showMessageDialog() - Displaying Message Dialog Boxes

 showConfirmDialog() - Displaying Confirmation Dialog Boxes

 Receiving Inputs from Confirmation Dialog Boxes

 showInputDialog() - Displaying Input Dialog Boxes

 showOptionDialog() - Displaying Option Dialog Boxes

 showInternal*Dialog() - Displaying Internal Dialog Boxes

 createDialog() - Creating Dialog Boxes Directly

 JEditorPane - The Editor Pane Class

 SwingWorker - The Background Task Worker

 References

 PDF Printing Version