uicontrols

Convenience functions that create user interface controls.
textField( [text], [columns], [listener] )
textArea( [text], [rows], [columns], [scroll] )
codeArea( [text], [preferredWidth], [preferredHeight] )
button( [label], [icon], [listener] )
repeaterButton( [label], [icon], [listener] )
toggleButton( [label], [icon], [selected], [listener] )
checkBox( [label], [selected], [listener] )
comboBox( [list], [listener] )
autocompletionField( items, [sort] )
label( [text], [labelFor] )
noteLabel( [text] )
hyperlink( [text], url )
spinner( [min], [max], [stepSize], [initialValue], [listener] )
slider( [min], [max], [initialValue], [valueLabelPairs], [listener] )
tintPanel()

Convenience functions that create user interface controls.

These functions make it easy to create UI controls to add to a container layout. See the plug-in authoring kit for examples that use this library.

textField( [text], [columns], [listener] )

Returns a new swing.JTextField.

text optional initial text for the field
columns an optional number of columns for the width of the field
listener an optional function that will be called when enter is pressed in the field

returns the new text field

textArea( [text], [rows], [columns], [scroll] )

Returns a new JTextArea.

text optional initial text for the text area
rows an optional number of rows for the width of the text area
columns an optional number of columns for the width of the text area
scroll if true, a scroll pane will be wrapped around the text area and returned

returns the new text area

codeArea( [text], [preferredWidth], [preferredHeight] )

Returns a new script editor control. The code area object includes an execute() function that will run the script code contained in the editor.

text optional initial text for the code area
preferredWidth an optional preferred width for the control (default is 400)
preferredHeight an optional preferred height for the control (default is 300)

returns the new code editor

button( [label], [icon], [listener] )

Returns a new swing.JButton.

label an optional text label for the button
icon an optional icon for the button
listener an optional function that will be called when the button is pressed

returns the new button

repeaterButton( [label], [icon], [listener] )

Returns a new button that continues to send notify the listener at intervals as long as it is pressed down. The rate of listener notifications increases the longer the button is held down. The button tracks the modifier keys that are held down while repeating and passes these through the ActionEvents that it generates. (For example, portrait panel jumps in bigger steps if Shift is held down while nudging a portrait.

label an optional text label for the button
icon an optional icon for the button
listener an optional function that will be called when the button is pressed

returns the new button

toggleButton( [label], [icon], [selected], [listener] )

Returns a new swing.JToggleButton.

label an optional text label for the button
icon an optional icon for the button
selected if true, the box is initially checked
listener an optional function that will be called when the button is pressed

returns the new button

checkBox( [label], [selected], [listener] )

Returns a new swing.JCheckBox.

label an optional text label for the button
selected if true, the box is initially checked
listener an optional function that will be called when the box is checked or unchecked

returns the new check box

comboBox( [list], [listener] )

Returns a new swing.JComboBox containing the items in list.

autocompletionField( items, [sort] )

Create a text field with a drop-down autocompletion list.

items an array of items the the field will use to offer autocompletion choices
sorted an optional flag indicating that the item list should be sorted, which allows faster autocompletion

returns a new, editable swing.JComboBox with autocompletion support

label( [text], [labelFor] )

Returns a new JLabel.

text initial label text (default is an empty string)
labelFor the component that this labels; this is used to determine which
control to activate if the label has a mnemonic key set

returns a new label

noteLabel( [text] )

Returns a new note label, a label with a smaller than usual font size that can be used to add remarks, tips, or other secondary information.

text the text of the note label

returns a new label with a smaller font

hyperlink( [text], url )

Returns a new hyperlink label. This is a label with underlined blue text that opens a URL in the user's default browser when clicked.

text an optional text label (default is to use url)
url the URL to visit when the label is clicked

returns the new hyperlink label

spinner( [min], [max], [stepSize], [initialValue], [listener] )

Creates a new spinner control that can be set to one of a range of integer values between min and max, inclusive. Each click of a spinner arrow will add or subtract stepSize from the current value.

min the minimum value that the spinner will allow (default is 1)
max the maximum value that the spinner will allow (default is 10)
stepSize the amount added to the current value by clicking an arrow button (default is 1)
initialValue the initial value stored in the spinner (default is min)
listener an optional listener (swing.event.ChangeListener) that will be called when the value changes

slider( [min], [max], [initialValue], [valueLabelPairs], [listener] )

Creates a new slider control that can be set to one of a range of integer values between min and max, inclusive. If valueLabelPairs is supplied, it must be an array where the even indices are slider positions and the odd indices are labels. The control will display the requested labels at the indicated positions. For example: [1, "Low", 6, "Medium", 10, "High"] would display the labels "Low", "Medium", and "High" at positions 1, 6, and 10 on the slider, respectively.

min the minimum value that the slider will allow (default is 1)
max the maximum value that the slider will allow (default is 10)
stepSize the amount added to the current value by clicking an arrow button (default is 1)
valueLabelPairs an array that associates slider positions with labels
listener an optional listener (swing.event.ChangeListener) that will be called when the value changes

tintPanel()

Creates a new control panel for adjusting tints.

Index    Contents