Display a question message in Java

Description

The following code shows how to display a question message.

Example


/*  ww w .  java2s. c  o m*/
import javax.swing.JOptionPane;

public class Main {
  public static void main(String[] args) {

    JOptionPane.showMessageDialog(null, "Are you sure to quit?", "Question",
        JOptionPane.QUESTION_MESSAGE);
  }
}

The code above generates the following result.

Display a question message in Java




















Home »
  Java Tutorial »
    Swing »




Action
Border
Color Chooser
Drag and Drop
Event
Font Chooser
JButton
JCheckBox
JComboBox
JDialog
JEditorPane
JFileChooser
JFormattedText
JFrame
JLabel
JList
JOptionPane
JPasswordField
JProgressBar
JRadioButton
JScrollBar
JScrollPane
JSeparator
JSlider
JSpinner
JSplitPane
JTabbedPane
JTable
JTextArea
JTextField
JTextPane
JToggleButton
JToolTip
JTree
Layout
Menu
Timer