Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import groovy.swing.SwingBuilder

 
import javax.swing.*


def swingBuilder = new SwingBuilder()
def options = ['1995', '2003', '2007']
def pane = swingBuilder.optionPane(message:'LOLGroovy Production (c)2009').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

  • UI
  • alignmentX
  • alignmentY
  • background
  • border
  • component
  • componentCount
  • componentPopupMenu
  • components
  • containerListeners
  • enabled
  • focusCycleRoot
  • focusTraversalKeys
  • focusTraversalPolicy
  • focusTraversalPolicyProvider
  • focusTraversalPolicySet
  • focusable
  • font
  • foreground
  • icon
  • inheritsPopupMenu
  • initialSelectionValue
  • initialValue
  • inputValue
  • inputVerifier
  • insets
  • layout
  • maximumSize
  • message
  • messageType
  • minimumSize
  • opaque
  • optionType
  • options
  • preferredSize
  • selectionValues
  • transferHandler
  • value
  • verifyInputWhenFocusTarget
  • wantsInput