function GetTrinary(message, option1, option2, option3) { script = "" + "title = 'Three Doors';\n" + "message = '" + message + "';\n" + "option1 = '" + option1 + "';\n" + "option2 = '" + option2 + "';\n" + "option3 = '" + option3 + "';\n" + "options = [option1, option2, option3];\n" + "rval = javax.swing.JOptionPane.showOptionDialog(Packages.ij.IJ.getInstance(), message, title, javax.swing.JOptionPane.DEFAULT_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE, null, options, options[0]);\n" + "rval == javax.swing.JOptionPane.CLOSED_OPTION ? null : options[rval];\n"; return eval("js", script); } answer = GetTrinary("Do you like green eggs and ham?", "yes", "no", "sometimes"); print(answer);