Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Generated Object

A javax.swing.JButton is returned, unless the user passes in a subclass of JButton as the value argument, in which case the value argument is returned.

Attributes

See also: JComponent

Declared in JButton

  • defaultButton <boolean> Whether or not this button is the default button
  • defaultCapable <boolean> Whether or not this button can be the default button

Declared in AbstractButton

  • action <Action> the Action instance connected with this ActionEvent source
  • actionCommand <String> actionCommand
  • model <ButtonModel> Model that the Button uses.
  • multiClickThreshhold <long> multiClickThreshhold
  • selected <boolean> selected
Text related
  • text <String> The button's text.
  • label <String> Replace by setText(text)
  • mnemonic <int> the keyboard character mnemonic
  • displayedMnemonicIndex <int> the index into the String to draw the keyboard character mnemonic at
  • horizontalTextPosition <int> The horizontal position of the text relative to the icon.
  • verticalTextPosition <int> The vertical position of the text relative to the icon.
Rendering related
  • borderPainted <boolean> Whether the border should be painted.
  • contentAreaFilled <boolean> Whether the button should paint the content area or leave it transparent.
  • focusPainted <boolean> Whether focus should be painted
  • rolloverEnabled <boolean> Whether rollover effects should be enabled.
  • margin <Insets> The space between the button's border and the label
  • iconTextGap <int> If both the icon and text properties are set, this property defines the space between them.
Icon related
  • icon <Icon> The button's default icon
  • disabledIcon <Icon> The disabled icon for the button.
  • pressedIcon <Icon> The pressed icon for the button.
  • rolloverIcon <Icon> The rollover icon for the button.
  • selectedIcon <Icon> The selected icon for the button.
  • disabledSelectedIcon <Icon> The disabled selection icon for the button.
  • rolloverSelectedIcon <Icon> The rollover selected icon for the button.
Alignment Related
  • horizontalAlignment <int> The horizontal alignment of the icon and text.
  • verticalAlignment <int> The vertical alignment of the icon and text.

Content

No child content is accepted in a button.

Usage

button creates a slider-bar type widget.
//TODO add an image
//TODO describe how to fire code on a button press

The selected property is not very interesting for the Button class, as it is not user changeable. This is mostly a leaky abstraction for checkBox and radioButton

Examples

This will run as a Groovy script.

//TBD further examples for icon related behaviour

Observable Attributes

  • defaultCapable
  • selected - via synthetic observation
  • action
  • borderPainted
  • contentAreaFilled
  • disabledIcon
  • disabledSelectedIcon
  • displayedMnemonicIndex
  • focusPainted
  • hideActionText
  • horizontalAlignment
  • horizontalTextPosition
  • icon
  • iconTextGap
  • label
  • margin
  • mnemonic
  • model
  • pressedIcon
  • rolloverEnabled
  • rolloverIcon
  • rolloverSelectedIcon
  • selectedIcon
  • text
  • verticalAlignment
  • verticalTextPosition
  • No labels