public class ToggleCommand extends java.lang.Object implements GUICommand
GUICommand
which toggles the visibility of a target GUIElement
.Modifier and Type | Field and Description |
---|---|
private java.lang.Runnable |
executeRunnable
The
Runnable that implements the functionality of execute() . |
private java.awt.Component |
target
The gui element to toggle.
|
Constructor and Description |
---|
ToggleCommand(java.awt.Component target)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canExecute()
Returns whether this command may be executed.
|
void |
execute()
Executes the command.
|
@NotNull private final java.lang.Runnable executeRunnable
Runnable
that implements the functionality of execute()
.@NotNull private final java.awt.Component target
public ToggleCommand(@NotNull java.awt.Component target)
target
- the gui element to togglepublic boolean canExecute()
canExecute
in interface GUICommand
public void execute()
GUICommand.canExecute()
returns false
.execute
in interface GUICommand