(Automatically generated from BeanInfo)
A javax.swing.JOptionPane is returned, unless the user passes in a subclass of JOptionPane as the value argument, in which case the value argument is returned.
import groovy.swing.SwingBuilder import javax.swing.* def swingBuilder = new SwingBuilder() def options = ['1995', '2003', '2007'] def pane = swingBuilder.optionPane(message:'Groovy starts in ', selectionValues:options, optionType:JOptionPane.CLOSED_OPTION) def dialog = pane.createDialog(null, 'worthless message') dialog.show() pane = swingBuilder.optionPane( message:'Are you sure that Groovy starts in ', selectionValues:options, initialSelectionValue:pane.getInputValue(), messageType:JOptionPane.QUESTION_MESSAGE, optionType:JOptionPane.OK_CANCEL_OPTION) dialog = pane.createDialog(null, 'worthless message') dialog.show() def choice def lastPane = swingBuilder.optionPane() choice = lastPane.showOptionDialog( null, 'worthless message', 'Last chance : Groovy starts in ', JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options as Object[], pane.getInputValue()) println options[choice] |