 A standard
push button
|
 Buttons can
have images
|
 Buttons can
be only images
|
 Buttons can
display state
|
The Button component is a versatile component, often used for things like opening/closing windows, writing to tags, and triggering any sort of scripting logic. It can be used for showing status, as well. For example, if you have three buttons, Hand, Off, and Auto, not only can they set those modes, but their background color can display the current mode, although you'd be better off using the Multi-State Button for this.
To get buttons to do things, you add an event handler to the actionPerformed event. Many new users to the 1.0.0 module will configure an event handler for the mouseClicked event instead. While this will work, it is better to use the actionPerformed event. Why? Buttons can also be activated by tabbing over to them and hitting the space key, or they could be activated by pressing Alt and the button's mnemonic character. So, to make sure that your button works in all of these cases, configure your event handler on the actionPerformed event, not the mouseClicked event.
See also:
Typical Navigation Strategy
Event Types
Appearance
|
Font
|
Font of text of this component
|
Foreground Color
|
The foreground color of the component.
|
Background Color
|
The background color of the button.
|
Background 3D?
|
Should this button have a 3d type background, or a flat color one?
|
|
background3D
|
|
|
boolean
|
|
|
expert
|
|
Fill Area?
|
Controls whether or not this button's internal area is filled
|
|
contentAreaFilled
|
|
|
boolean
|
|
|
expert
|
|
Border Painted?
|
Should the border of this button be displayed?
|
|
borderPainted
|
|
|
boolean
|
|
|
expert
|
|
Text
|
Text of this component
|
Image Path
|
The relative path of the image.
|
Disabled Image Path
|
The relative path of the image to be displayed when this component is not enabled.
|
|
disabledPath
|
|
|
String
|
|
|
expert
|
|
Icon-Text Spacing
|
The space (in pixels) between the icon (if any) and the text (if any)
|
Styles
|
Contains the component's styles
|
|
styles
|
|
|
Dataset
|
|
|
bindable | expert
|
|
Behavior
|
Rollover
|
If true, the button may indicate that the mouse is hovering over it.
|
|
rolloverEnabled
|
|
|
boolean
|
|
|
expert
|
|
Focusable
|
If a button is not focusable, you will not be able to interact with it with the keyboard. This means you can't "tab" over to it.
|
Mnemonic
|
A single letter that will activate the button using 'ALT-mnemonic'.
|
Default Button
|
If true, this button will be activated when the user presses enter on the window.
|
|
defaultBtn
|
|
|
boolean
|
|
|
expert
|
|
Common
|
Name
|
The name of this component.
|
Enabled
|
If disabled, a component cannot be used.
|
Visible
|
If disabled, the component will be hidden.
|
Mouseover Text
|
The text that is displayed in the tooltip which pops up on mouseover of this component.
|
Cursor
|
The mouse cursor to use when hovering over this component.
|
|
cursorCode
|
|
|
int
|
|
|
0
|
Default
|
1
|
Crosshair
|
2
|
Text
|
3
|
Wait
|
12
|
Hand
|
13
|
Move
|
4
|
SW Resize
|
5
|
SE Resize
|
6
|
NW Resize
|
7
|
NE Resize
|
8
|
N Resize
|
9
|
S Resize
|
10
|
W Resize
|
11
|
E Resize
|
|
|
Border
|
The border surrounding this component. NOTE that the border is unaffected by rotation.
|
Opaque
|
Is this button completely opaque? Most aren't, so this should usually be false.
|
Data
|
Data Quality
|
The data quality code for any tag bindings on this component.
|
|
dataQuality
|
|
|
int
|
|
|
bindable | expert
|
|
Layout
|
Margin
|
The space between a button's text and its borders.
|
Horizontal Alignment
|
The horizontal alignment of the button's contents (text and/or image)
|
|
horizontalAlignment
|
|
|
int
|
|
|
2
|
Left
|
0
|
Center
|
4
|
Right
|
10
|
Leading
|
11
|
Trailing
|
|
|
Horizontal Text Position
|
The horizontal position of the button's text relative to its image
|
|
horizontalTextPosition
|
|
|
int
|
|
|
expert
|
|
|
2
|
Left
|
0
|
Center
|
4
|
Right
|
10
|
Leading
|
11
|
Trailing
|
|
|
Vertical Alignment
|
The vertical alignment of the button's contents (text and/or image)
|
Vertical Text Position
|
The vertical position of the button's text relative to its image
|
|
verticalTextPosition
|
|
|
int
|
|
|
expert
|
|
|
|
|
The following event sets are fired by this component. See Component Event Handlers to learn more.
doClick()
|
Virtually "clicks" the button, meaning that its actionPerformed event handler will run.
|
|