public class ActionExample3 extends Application
enabledProperty
@Action
annotation parameter.
This example is nearly identical to ActionExample1
.
We've added a parameter to the @Action
annotation for the
clearTitle
action:
@Action(enabledProperty = "clearEnabled") public void clearTitle() { appFrame.setTitle(textField.getText()); setClearEnabled(true); }The annotation parameter names a bound property from the same class. When the
clearEnabled
property is set to false, as it is after
the window's title has been cleared, the clearTitle
Action
is disabled.Application.ExitListener
Constructor and Description |
---|
ActionExample3() |
Modifier and Type | Method and Description |
---|---|
void |
clearTitle() |
boolean |
isClearEnabled() |
static void |
main(java.lang.String[] args) |
void |
setClearEnabled(boolean clearEnabled) |
void |
setTitle() |
protected void |
startup()
Responsible for starting the application; for creating and showing
the initial GUI.
|
addExitListener, end, exit, exit, getContext, getExitListeners, getInstance, getInstance, hide, initialize, launch, quit, ready, removeExitListener, show, shutdown
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
@Action public void setTitle()
@Action(enabledProperty="clearEnabled") public void clearTitle()
public boolean isClearEnabled()
public void setClearEnabled(boolean clearEnabled)
protected void startup()
Application
This method is called by the static launch
method,
subclasses must override it. It runs on the event dispatching
thread.
startup
in class Application
Application.launch(java.lang.Class<T>, java.lang.String[])
,
Application.initialize(java.lang.String[])
,
Application.shutdown()
public static void main(java.lang.String[] args)