List of usage examples for javax.swing JOptionPane showMessageDialog
public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException
messageType
parameter. From source file:Main.java
public static void main(String[] argv) { JOptionPane.showMessageDialog(null, "The message", "The Title", JOptionPane.INFORMATION_MESSAGE); }
From source file:Main.java
public static void main(String argv[]) { String message = "line\n" + "line 2\n" + "line 3"; JOptionPane.showMessageDialog(new JFrame(), message, "Dialog", JOptionPane.ERROR_MESSAGE); }
From source file:JOptionPaneWARNING_MESSAGE.java
public static void main(String[] args) { final JPanel panel = new JPanel(); JOptionPane.showMessageDialog(panel, "A deprecated call", "Warning", JOptionPane.WARNING_MESSAGE); }
From source file:JOptionPaneERROR_MESSAGE.java
public static void main(String[] args) { final JPanel panel = new JPanel(); JOptionPane.showMessageDialog(panel, "Could not open file", "Error", JOptionPane.ERROR_MESSAGE); }
From source file:JOptionPaneQUESTION_MESSAGE.java
public static void main(String[] args) { final JPanel panel = new JPanel(); JOptionPane.showMessageDialog(panel, "Are you sure to quit?", "Question", JOptionPane.QUESTION_MESSAGE); }
From source file:JOptionPaneINFORMATION_MESSAGE.java
public static void main(String[] args) { final JPanel panel = new JPanel(); JOptionPane.showMessageDialog(panel, "Download completed", "Question", JOptionPane.INFORMATION_MESSAGE); }
From source file:ErrorDialog.java
public static void main(String argv[]) { String message = "\"The Comedy of Errors\"\n" + "is considered by many scholars to be\n" + "the first play Shakespeare wrote"; JOptionPane.showMessageDialog(new JFrame(), message, "Dialog", JOptionPane.ERROR_MESSAGE); }
From source file:Main.java
public static void main(String[] args) { Object[] options = { "Option 1", "Option 2", "Option 3", "None of the above" }; JComboBox optionControl = new JComboBox(options); optionControl.setSelectedIndex(3);// w w w. j a v a 2 s . c o m JOptionPane.showMessageDialog(null, optionControl, "Option", JOptionPane.QUESTION_MESSAGE); System.out.println(optionControl.getSelectedItem()); String graphSelection = (String) JOptionPane.showInputDialog(null, "Choose from the following options...", "Choose From DropDown", JOptionPane.QUESTION_MESSAGE, null, options, options[3]); System.out.println(graphSelection); JOptionPane.showMessageDialog(null, optionControl, "Option", JOptionPane.QUESTION_MESSAGE); }
From source file:Main.java
public static void main(String s[]) { JFileChooser chooser = new JFileChooser(); int rc = chooser.showOpenDialog(null); while (rc == JFileChooser.APPROVE_OPTION && !chooser.getSelectedFile().getName().endsWith(".java")) { JOptionPane.showMessageDialog(null, "The file " + chooser.getSelectedFile() + " is not java source file.", "Open Error", JOptionPane.ERROR_MESSAGE); rc = chooser.showOpenDialog(null); }//from w w w.ja v a 2 s .c o m }
From source file:Main.java
public static void main(String[] args) throws Exception { Object[] options = { "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", "Option 6", "Option 7", "None of the above" }; JComboBox optionList = new JComboBox(options); optionList.setSelectedIndex(7);//from ww w . j a v a 2 s. c o m JOptionPane.showMessageDialog(null, optionList, "Title", JOptionPane.QUESTION_MESSAGE); }