Quantcast
Channel: How to use JOptionPane with many options? java - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Sambhav for How to use JOptionPane with many options? java

$
0
0
    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");              }

Viewing all articles
Browse latest Browse all 3

Trending Articles