Just see option is of int type. Hence JOptionPane.showOptionDialog(null, "Title", "Message", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE,null, options, options[0]) is returning an integer value. You may use it as: if (option == 0) { System.out.println("Go Ahead"); } else if ( option == 1) { System.out.println("Go back"); } else if (option == 2 ) { System.out.println("Go forward"); } else if (option == 3) { System.out.println("close me"); }
↧
Answer by Sambhav for How to use JOptionPane with many options? java
↧
Trending Articles
More Pages to Explore .....