List of usage examples for javax.swing JOptionPane QUESTION_MESSAGE
int QUESTION_MESSAGE
To view the source code for javax.swing JOptionPane QUESTION_MESSAGE.
Click Source Link
From source file:ManyOptions.java
public static void main(String[] args) { JOptionPane.showInputDialog(null, "Please choose a name", "Example 1", JOptionPane.QUESTION_MESSAGE, null, new Object[] { "Amanda", "Colin", "Don", "Fred", "Gordon", "Janet", "Jay", "Joe", "Judie", "Kerstin", "Lotus", "Maciek", "Mark", "Mike", "Mulhern", "Oliver", "Peter", "Quaxo", "Rita", "Sandro", "Tim", "Will" }, "Joe"); }
From source file:MainClass.java
public static void main(String[] a) { JOptionPane optionPane = new JOptionPane("Continue printing?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); JDialog dialog = optionPane.createDialog(null, "Manual Creation"); dialog.setVisible(true);/*from w w w .j a v a 2s .com*/ }
From source file:Main.java
public static void main(String args[]) { int n = JOptionPane.showOptionDialog(new JFrame(), "Message", "Title", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[] { "Yes", "No" }, JOptionPane.YES_OPTION); if (n == JOptionPane.YES_OPTION) { System.out.println("Yes"); } else if (n == JOptionPane.NO_OPTION) { System.out.println("No"); } else if (n == JOptionPane.CLOSED_OPTION) { System.out.println("Closed by hitting the cross"); }//from w w w . j a va2s .com }
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:Main.java
public static void main(String[] args) { int response = JOptionPane.showConfirmDialog(null, "Save the file?", "Confirm Save Changes", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); switch (response) { case JOptionPane.YES_OPTION: System.out.println("yes"); break;//from w w w . j av a2s .c o m case JOptionPane.NO_OPTION: System.out.println("no"); break; case JOptionPane.CANCEL_OPTION: System.out.println("cancel"); break; case JOptionPane.CLOSED_OPTION: System.out.println("closed."); break; default: System.out.println("something else"); } }
From source file:Main.java
public static void main(String[] args) throws Exception { JOptionPane jop = new JOptionPane("Message", JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION); JDialog dialog = jop.createDialog("Dialog Title"); Image image = ImageIO.read(new URL("http://www.java2s.com/style/download.png")); dialog.setIconImage(image);/*from w ww .j av a 2 s. c o m*/ dialog.setVisible(true); }
From source file:CreateDialogFromOptionPane.java
public static void main(final String[] args) { JFrame parent = new JFrame(); JOptionPane optionPane = new JOptionPane("Continue printing?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); JDialog dialog = optionPane.createDialog(parent, "Manual Creation"); dialog.setVisible(true);/*w ww .jav a 2 s .c om*/ }
From source file:Main.java
public static void main(String[] args) { final JFrame frame = new JFrame(); JOptionPane pane = new JOptionPane("Some message", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION) { @Override/*from w ww . j ava 2s . c om*/ public void setValue(Object newValue) { super.setValue(newValue); JOptionPane.showMessageDialog(frame.getContentPane(), "You have hit " + newValue); } }; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new JLabel("Some panel in the middle"), BorderLayout.CENTER); frame.add(pane, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
From source file:InputDialogWithDropdownListbox.java
public static void main(String[] a) { String[] choices = { "A", "B", "C", "D", "E", "F" }; String input = (String) JOptionPane.showInputDialog(null, "Choose now...", "The Choice of a Lifetime", JOptionPane.QUESTION_MESSAGE, null, // Use // default // icon choices, // Array of choices choices[1]); // Initial choice System.out.println(input);//from w ww .ja v a2s . c o m }
From source file:Main.java
public static void main(String[] args) { JFrame frame;/*from w ww .j a va 2 s .c o m*/ Object[] options = { "A", "B", "C", "D" }; int choice = JOptionPane.showOptionDialog(null, "Nuovo Prodotto", "Scegli il prodotto", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (choice == 0) { System.out.println("0 selected"); } else { System.out.println("Something else selected"); } }