how-to

Dialogs

Classical message dialog

For working with dialogs in Java you need use this include:

import javax.swing.JOptionPane;
Simplest variant of message box in Java is this code,
JOptionPane.showMessageDialog( null , "This is message." );
where first parametr is owner (can be null) for application, and second parametr is text for display.
Method JOptionPane.showMessageDialog() has more variant. One of this can change title of window (third parameter) and type of icon (fourth parameter),
JOptionPane.showMessageDialog( null, "This is message.", "Title", JOptionPane.ERROR_MESSAGE );