joptionpane with drop down list java

Solutions on MaxInterview for joptionpane with drop down list java by the best coders in the world

showing results for - "joptionpane with drop down list java"
Lola
08 May 2017
1package com.mkyong.inputDialog;
2
3import javax.swing.ImageIcon;
4import javax.swing.JOptionPane;
5
6public class InputDialog6a {
7
8    public static void main(String[] args) {
9
10        String[] options = {"I adore turtles", "Yes", "Maybe", "Urm...", "No", "Hate them"};
11        ImageIcon icon = new ImageIcon("src/images/turtle32.png");
12        String n = (String)JOptionPane.showInputDialog(null, "Do you like turtles??", 
13                "I like turtles", JOptionPane.QUESTION_MESSAGE, icon, options, options[2]);
14        System.out.println(n);
15
16    }
17
18}
19Copy