Class UIPushButton
public class UIPushButton extends UIButton
{
// Fields
public static final int FLAT_PRESSED;
public static final int RAISED;
public static final int THICK;
// Constructors
public UIPushButton();
public UIPushButton(String text);
public UIPushButton(String text, int style);
public UIPushButton(IUIComponent comp);
public UIPushButton(IUIComponent comp, int style);
// Methods
public synchronized void addActionListener(IUIActionListener l);
public Insets getInsets();
public int getRoleCode();
public void paint(FxGraphics g);
protected void processActionEvent(UIActionEvent e);
protected void processEvent(UIEvent e);
public synchronized void removeActionListener(
IUIActionListener l);
public void setChecked(boolean on);
public void setFocused(boolean on);
public void setHot(boolean on);
public void setPressed(boolean on);
public void setStyle(int style);
}
This class implements a push button control. For more information about buttons, see the UIButton overview.
Note The hot-track color is the same color as the button text color. As a result, hot-tracking does not appear to be functional.
UIComponent
|
+--UIContainer
|
+--UIStateContainer
|
+--UISingleContainer
|
+--UIButton
|
+--UIPushButton
public UIPushButton();
Creates a push button control with no content.
Remarks:
By default, the button's style is RAISED.
public UIPushButton(String text);
Creates a push button control with the specified text.
Parameter | Description |
text
| The text to be displayed within the button.
|
Remarks:
By default, the button is hot-tracked and has a flat style. To create a button that is not hot-tracked, pass a UIText object instead of a String. For more information about hot-tracking, see the UIButton overview.
public UIPushButton(String text, int style);
Creates a push button control with the specified text and style.
Parameter | Description |
text
| The text to be displayed within the button.
|
style
| The style of the button. Possible values include any bitwise combination of RAISED, TOGGLE, and TRITOGGLE. (Combining TOGGLE and TRITOGGLE results in TRITOGGLE.) To specify a flat style, pass 0 for this parameter.
|
Remarks:
By default, the button is hot-tracked. To create a button that is not hot-tracked, pass a UIText object instead of a String. For more information about hot-tracking, see the UIButton overview.
Exceptions:
IllegalArgumentException
if an undefined style was specified.
public UIPushButton(IUIComponent comp);
Creates a push button control with the specified component.
Parameter | Description |
comp
| The component to be displayed within the button.
|
Remarks:
Typically, you'll pass a UIText, a UIGraphic, or a UIItem object for the component. By default, the button's style is RAISED. For examples of how to construct buttons, see the UIButton overview.
public UIPushButton(IUIComponent comp, int style);
Creates a push button control with the specified component and style.
Parameter | Description |
comp
| The component to be displayed within the button.
|
style
| The style of the button. Possible values include any bitwise combination of RAISED, TOGGLE, and TRITOGGLE. (Combining TOGGLE and TRITOGGLE results in TRITOGGLE.) To specify a flat style, pass 0 for this parameter.
|
Remarks:
Typically, you'll pass a UIText, a UIGraphic, or a UIItem object for the component. For examples of how to construct buttons, see the UIButton overview.
Exceptions:
IllegalArgumentException
if an undefined style was specified.
public synchronized void addActionListener(IUIActionListener l);
Adds the specified action listener. The listener receives all action events generated for the button.
Return Value:
No return value.
Parameter | Description |
l
| The action listener to be added.
|
Overrides:
addActionListener(IUIActionListener) in UIButton.
See Also: removeActionListener
public Insets getInsets();
Retrieves the button control's insets (in pixels), which identify the non-client area of the control.
Return Value:
Returns an Insets object that contains the control's insets.
Remarks:
The button control's insets are based on its current styles and states.
public int getRoleCode();
Retrieves the ROLE_SYSTEM code that best describes the role of the push button.
Return Value:
Returns the ROLE_SYSTEM_PUSHBUTTON code.
public void paint(FxGraphics g);
Draws the push button control, according to its current states and styles.
Return Value:
No return value.
Parameter | Description |
g
| The graphics context.
|
protected void processActionEvent(UIActionEvent e);
Processes action events.
Return Value:
No return value.
Parameter | Description |
e
| The action event.
|
Remarks:
This method is called by processEvent and dispatches the event to a registered action listener. When overriding this method, call the super method processActionEvent to ensure that the default event processing continues normally.
Overrides:
processActionEvent(UIActionEvent) in UIButton.
See Also: addActionListener
protected void processEvent(UIEvent e);
Processes the specified event.
Return Value:
No return value.
Parameter | Description |
e
| The event.
|
Remarks:
This method is automatically invoked if a listener has been registered through a call to addXXXListener. Depending on the type of event, processEvent calls one of the following methods.
When overriding processEvent, call the super method processEvent to ensure the default event processing continues normally.
Overrides:
processEvent(UIEvent) in UIButton.
public synchronized void removeActionListener(IUIActionListener l);
Removes the specified action listener. The listener no longer receives the button's action events.
Return Value:
No return value.
Parameter | Description |
l
| The action listener to be removed.
|
Overrides:
removeActionListener(IUIActionListener) in UIButton.
See Also: addActionListener
public void setChecked(boolean on);
Sets or clears the checked state of the button.
Return Value:
No return value.
Parameter | Description |
on
| If true, the checked state is set; otherwise, it is cleared.
|
Remarks:
This method lays out the button control to display the new state. For more information about states, see the UIStateContainer overview.
public void setFocused(boolean on);
Sets or clears the focus state of the button.
Return Value:
No return value.
Parameter | Description |
on
| If true, the focus state is set; otherwise, it is cleared.
|
Remarks:
This method lays out the button control, as needed, to display the new state. For more information about states, see the UIStateContainer overview.
public void setHot(boolean on);
Sets or clears the hot-tracked state of the button.
Return Value:
No return value.
Parameter | Description |
on
| If true, the hot-tracked state is set; otherwise, it is cleared.
|
Remarks:
This method lays out the button control, as needed, to display the new state. For more information about states, see the UIStateContainer overview.
Overrides:
setHot(boolean) in UIButton.
public void setPressed(boolean on);
Sets or clears the pressed state of the button.
Return Value:
No return value.
Parameter | Description |
on
| If true, the pressed state is set; otherwise, it is cleared.
|
Remarks:
This method lays out the button control to display the new state. For more information about states, see the UIStateContainer overview.
public void setStyle(int style);
Sets the current style for the button.
Return Value:
No return value.
Parameter | Description |
style
| The style of the button. You can pass any bitwise combination of RAISED, TOGGLE, and TRITOGGLE. that combining TOGGLE and TRITOGGLE results in TRITOGGLE.) To specify a flat style, pass 0 for this parameter.
|
Overrides:
setStyle(int) in UIButton.
Exceptions:
IllegalArgumentException
if an undefined style was specified.
- FLAT_PRESSED
- Specifies that the push button has a flat look when pressed.
- RAISED
- Specifies that the push button is raised.
- THICK
- Specifies that the push button has a thicker three-dimensional bevel edge.