public class FlexButton extends FlexObject
Buttons typically use event listeners to perform an action when the user selects the control. When a user clicks the mouse on a Button control, and the Button control is enabled, it dispatches a click event and a buttonDown event. A button always dispatches events such as the mouseMove, mouseOver, mouseOut, rollOver, rollOut, mouseDown, and mouseUp events whether enabled or disabled.
You can customize the look of a Button control and change its functionality from a push button to a toggle button. You can change the button appearance by using a skin for each of the button's states.
The label of a Button control uses a bold typeface. If you embed a font that you want to use for the label of the Button control, you must embed the bold typeface.
Modifier | Constructor and Description |
---|---|
protected |
FlexButton(JtfObjectHandle handle,
Desktop desktop)
Creates a new FlexButton with a JtfObjectHandle.
|
Modifier and Type | Method and Description |
---|---|
Color |
getColor()
Gets the color of text in the component, including the component label.
|
Color |
getDisabledColor()
Gets the color of text in the component if it is disabled.
|
List<Double> |
getFillAlphas()
Gets the alphas used for the background fill of controls.
|
List<Color> |
getFillColors()
Gets the colors used to tint the background of the control.
|
double |
getFocusAlpha()
Gets the alpha transparency value of the focus skin.
|
String |
getFontFamily()
Gets the name of the font to use.
|
double |
getFontSize()
Gets the height of the text, in pixels.
|
String |
getFontStyle()
Gets whether the text is italic font.
|
String |
getFontWeight()
Gets whether the text is boldface.
|
String |
getLabel()
Gets the text to appear on the Button control.
|
String |
getLabelPlacement()
Gets the orientation of the label in relation to a specified icon.
|
String |
getTextAlign()
Gets the alignment of text within a container.
|
String |
getTextDecoration()
Gets whether the text is underlined.
|
double |
getTextIndent()
Gets the offset of the first line of text from the left side of the container, in pixels.
|
Color |
getTextRollOverColor()
Gets the text color of the label as the user moves the mouse pointer over the button.
|
Color |
getTextSelectedColor()
Gets the text color of the label as the user presses it.
|
boolean |
isSelected()
Gets whether a toggle button is toggled on (true) or off (false).
|
boolean |
isToggle()
Gets whether a Button is in a toggle state or not.
|
void |
type(String keyCode)
Dispatched when the user presses a key.
|
void |
type(String keyCode,
ModifierKey keyModifier)
Dispatched when the user presses a key.
|
changeFocus, changeFocus, changeFocus, getAutomationClassName, getAutomationIndex, getAutomationName, getClassName, getCurrentState, getErrorColor, getErrorString, getId, getNumAutomationChildren, getPercentHeight, getPercentWidth, getScaleX, getScaleY, getThemeColor, getToolTip, isEnabled, isFocusEnabled, isUseHandCursor, move, move, move, setFocus
click, click, click, click, doubleClick, doubleClick, doubleClick, doubleClick, getAlpha, getHeight, getStyle, getTabIndex, getWidth, getX, getY, isMouseEnabled, isTabChildren, isTabEnabled, isVisible, mouseMove, mouseMove, nativeToString, pressKeys, pressKeys, pressMouse, pressMouse, pressMouse, pressMouse, releaseKeys, releaseKeys, releaseMouse, releaseMouse, releaseMouse, releaseMouse, typeKeys, typeKeys, typeKeys, typePasswordKeys, typePasswordKeys, typePasswordKeys
captureBitmap, captureBitmap, exists, exists, generateLocator, getChildren, getDynamicMethodList, getParent, getPropertyList, getRect, getRect, getText, getValue, highlightObject, highlightObject, highlightObject, invokeMethods, textCapture, textCapture, textClick, textClick, textClick, textClick, textClick, textClick, textExists, textExists, textExists, textExists, textExists, textRectangle, textRectangle, textRectangle, textRectangle, textRectangle, waitForChildDisappearance, waitForChildDisappearance, waitForDisappearance, waitForDisappearance, waitForObject, waitForObject, waitForProperty, waitForProperty
equals, exists, find, find, findAll, findAll, getCustomTypeName, getDesktop, getHandle, getLocator, getProperty, getTypeName, hashCode, imageClick, imageClick, imageClick, imageClick, imageClick, imageClick, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageExists, imageExists, imageExists, imageExistsFile, imageExistsFile, imageExistsFile, imageRectangle, imageRectangle, imageRectangle, imageRectangleFile, imageRectangleFile, imageRectangleFile, invoke, preventFinalLocator, setProperty, toString
protected FlexButton(JtfObjectHandle handle, Desktop desktop)
handle
- the handle that identifies the FlexButtondesktop
- the desktop on which this object livespublic void type(String keyCode)
Mappings between keys and specific characters vary by device and operating system. This event type is generated after such a mapping occurs but before the processing of an input method editor (IME). IMEs are used to enter characters, such as Chinese ideographs, that the standard QWERTY keyboard is ill-equipped to produce.
keyCode
- the key code value of the key pressed or releasedpublic void type(String keyCode, ModifierKey keyModifier)
Mappings between keys and specific characters vary by device and operating system. This event type is generated after such a mapping occurs but before the processing of an input method editor (IME). IMEs are used to enter characters, such as Chinese ideographs, that the standard QWERTY keyboard is ill-equipped to produce.
keyCode
- the key code value of the key pressed or releasedkeyModifier
- the key modifiers (for example, the Ctrl key) to use when clicking the controlpublic Color getColor()
public Color getDisabledColor()
public List<Double> getFillAlphas()
Use [1, 1] to make the control background opaque. The default value is [ 0.6, 0.4 ].
public List<Color> getFillColors()
Pass the same color for both values for a flat-looking control. The default value is [ 0xFFFFFF, 0xCCCCCC ].
public double getFocusAlpha()
public String getFontFamily()
Unlike in a full CSS implementation, comma-separated lists are not supported. You can use any font family name. If you specify a generic font name, it is converted to an appropriate device font. The default value is Verdana
.
public double getFontSize()
The default value is 10 for all controls except the ColorPicker control. For the ColorPicker control, the default value is 11.
public String getFontStyle()
Recognized values are normal
and italic
. The default value is normal
.
public String getFontWeight()
Recognized values are normal and bold. The default value for Button controls is bold. The default value for all other controls is normal.
public String getLabel()
If the label is wider than the Button control, the label is truncated and terminated by an ellipsis (...). The full label displays as a tooltip when the user moves the mouse over the Button control. If you have also set a tooltip by using the tooltip property, the tooltip is displayed rather than the label text.
The default value is "".
public String getLabelPlacement()
Valid MXML values are: right, left, bottom, and top.
In ActionScript, you can use the following constants to set this property: ButtonLabelPlacement.RIGHT, ButtonLabelPlacement.LEFT, ButtonLabelPlacement.BOTTOM, and ButtonLabelPlacement.TOP.
The default value is ButtonLabelPlacement.RIGHT.
public boolean isSelected()
This property can be set only if the toggle property is set to true.
For a CheckBox control, indicates whether the box is displaying a check mark. For a RadioButton control, indicates whether the control is selected.
The user can change this property by clicking the control, but you can also set the property programmatically.
In previous versions, if the toggle property was set to true, changing this property also dispatched a change event. Starting in version 3.0, setting this property programmatically only dispatches a valueCommit event.
The default value is false.
public String getTextAlign()
Possible values are:left, right, or center.
The default value for most components is left. For the FormItem component, the default value is right. For the Button, LinkButton, and AccordionHeader components, the default value is center, and this property is only recognized when the labelPlacement property is set to left or right. If labelPlacement is set to top or bottom, the text and any icon are centered.
public String getTextDecoration()
Possible values are none
and underline
. The default value is none
.
public double getTextIndent()
public Color getTextRollOverColor()
public Color getTextSelectedColor()
public boolean isToggle()
If true, clicking the button toggles it between a selected and an unselected state. You can get or set this state programmatically by using the selected property. If false, the button does not stay pressed after the user releases it. In this case, its selected property is always false.
Buttons like this are used for performing actions. When toggle is set to false, selected is forced to false because only toggle buttons can be selected.
The default value is false.
Copyright 2009-2012 Micro Focus. All Rights Reserved.