JDialog Flashcards
JDialog
Independant sub-window used for temporary purposes independent of main window content
JDialog Usage Examples
Display error messages
Display warnings
Present images
Directory trees
Swing component classes that directly instantiate and display dialogs
JOptionPane ProgressMonitor JColorChooser JFileChooser Printing API
What are dialogs dependent upon?
Frame components
If frame is iconified…
…dependent Dialogs dissapear from the screen
If frame is deiconified…
…dependent Dialogs return to the screen
Dialogs can be MODAL
Blocks user input to all other windows in the program
Create modal dialog
JOptionPane creates modal JDialogs
Create non-modal dialog
Use JDialog class directly
JDialog class is subclass of…
AWT (Abstract Windows ToolKit) java.awt.Dialog class
What does java.awt.Dialog class do?
Adds a root pane container and support for a default close operation to the Dialog object
JOptionPane
Container that automatically creates a JDialog and adds itself to the JDialog’s content pant
Using JOptionPane to customize
Lays out std dialog Provides icons Specify dialog title and text Customizing button text Customize components the dialog displays Specify where dialog appears on screen
JOptionPane icons
Question
Information
Warning
Error
Constructors for JDialog create a JDialog instance
Boolean argument
Set to true to specify model dialog, else set to false or absent
Specify title of dialog using string argument