(Automatically generated from BeanInfo)

Generated Object

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.

Attributes

Declared in javax.swing.JOptionPane

Declared in javax.swing.JComponent

Declared in java.awt.Container

Declared in java.awt.Component

Events

Declared in javax.swing.JComponent

Declared in java.awt.Container

Declared in java.awt.Component

Content

Usage

Examples


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]


Observable Attributes