public class NodeTools
extends Object
Modifier and Type | Field and Description |
---|---|
static String |
VERSION
Version number of this Package (read-only).
|
Modifier and Type | Method and Description |
---|---|
static javafx.scene.control.Button |
button(String text,
boolean isDefault,
boolean isCancel,
boolean hasMnemonic,
javafx.event.EventHandler<javafx.event.ActionEvent> handler)
Creates a more complete "Button" object more easily so as to keep code
simpler, and also more convenient to define fully-defined Button objects as
final class variables.
|
static javafx.scene.control.Button |
button(String text,
javafx.scene.Node image,
String tip,
boolean isDefault,
boolean isCancel,
boolean hasMnemonic,
javafx.event.EventHandler<javafx.event.ActionEvent> handler)
Creates a more complete "Button" object more easily so as to keep code
simpler, and also more convenient to define fully-defined Button objects as
final class variables.
|
static javafx.scene.control.Button |
button(String text,
javafx.scene.Node image,
javafx.scene.control.Tooltip tip,
boolean isDefault,
boolean isCancel,
boolean hasMnemonic,
javafx.event.EventHandler<javafx.event.ActionEvent> handler)
Creates a more complete "Button" object more easily so as to keep code
simpler, and also more convenient to define fully-defined Button objects as
final class variables.
|
static javafx.scene.control.Button |
button(String text,
String tip,
boolean isDefault,
boolean isCancel,
boolean hasMnemonic,
javafx.event.EventHandler<javafx.event.ActionEvent> handler)
Creates a more complete "Button" object more easily so as to keep code
simpler, and also more convenient to define fully-defined Button objects as
final class variables.
|
static javafx.scene.control.Button[] |
buttons(boolean hasMnemonic,
String... s)
Generates a Button[] array from the provided String objects.
|
static javafx.scene.control.ButtonBase |
fireMnemonic(char c,
javafx.scene.control.ButtonBase... bB)
If the specified character matches the mnemonic of any of the supplied
ButtonBase objects, then that first matching ButtonBase object's fire()
method will be called, and the object returned. This is useful for
dialogues that are meant to be more user-friendly by allowing the user to
press the corresponding key without having to hold down the Alt key at the
same time.
|
static javafx.scene.control.ButtonBase |
fireMnemonic(javafx.scene.input.KeyEvent k,
javafx.scene.control.ButtonBase... bB)
If the specified KeyEvent's character matches the mnemonic of any of the
supplied ButtonBase objects, then that first matching ButtonBase object's
fire() method will be called, and the object returned. This is useful
for dialogues that are meant to be more user-friendly by allowing the user to
press the corresponding key without having to hold down the Alt key at the
same time.
|
static char |
getMnemonic(javafx.scene.control.Labeled text)
Obtain the mnemonic character for the supplied javafx.scene.control.Labeled
object (or any of its subclasses). The mnemonic character is prefixed
by an underscore, except for underscores (because two underscores are used to
represent a single non-mnemonic underscore character) which will be ignored.
|
static char |
getMnemonic(String s)
Obtain the mnemonic character for the supplied String. The mnemonic
character is prefixed by an underscore, except for underscores (because two
underscores are used to represent a single non-mnemonic underscore character)
which will be ignored.
|
static <R extends javafx.scene.layout.Region> |
setBackgroundColor(R r,
javafx.scene.paint.Color bg)
Sets the background colour of the supplied Region object, or any of its
sub-classes by using the setBackgroun) method, except for TextInputControl
and any of its sub-classes (such as TextField and TextArea) for which CSS
is updated without clearing any of the other CSS settings.
|
static <R extends javafx.scene.layout.Region> |
setColors(R r,
javafx.scene.paint.Color bg,
javafx.scene.paint.Color fg)
Sets the background and foreground colours of the supplied TextInputControl
object (or any of its sub-classes, such as TextField or TextArea) without
clearing any of the other CSS settings.
|
static <R extends javafx.scene.layout.Region> |
setForegroundColor(R r,
javafx.scene.paint.Color fg)
Sets the foreground colour of the supplied TextInputControl object (or any
of its sub-classes, such as TextField or TextArea) without clearing any of
the other CSS settings.
|
public static final String VERSION
public static javafx.scene.control.Button button(String text, boolean isDefault, boolean isCancel, boolean hasMnemonic, javafx.event.EventHandler<javafx.event.ActionEvent> handler)
The handler may be specified as "this::handle" where "handle" is the name of the method to call (the class must implement the java.event.EventHandler interface) when this Button is activated by the user (e.g., using the keyboard, or mouse, or by touching the screen) or programatically.
text
- Button's label textisDefault
- Specifies whether this is a "Default" buttonisCancel
- Specifies whether this is a "Cancel" buttonhasMnemonic
- Specifies whether to parse for Mnemonic character ("_")handler
- Button's ActionEvent handler (use "null" if no handler)public static javafx.scene.control.Button button(String text, javafx.scene.Node image, String tip, boolean isDefault, boolean isCancel, boolean hasMnemonic, javafx.event.EventHandler<javafx.event.ActionEvent> handler)
The handler may be specified as "this::handle" where "handle" is the name of the method to call (the class must implement the java.event.EventHandler interface) when this Button is activated by the user (e.g., using the keyboard, or mouse, or by touching the screen) or programatically.
text
- Button's label textimage
- Button's icon (use "null" if no icon)tip
- Button's Tool tip text (use "null" if no Tool tip)isDefault
- Specifies whether this is a "Default" buttonisCancel
- Specifies whether this is a "Cancel" buttonhasMnemonic
- Specifies whether to parse for Mnemonic character ("_")handler
- Button's ActionEvent handler (use "null" if no handler)public static javafx.scene.control.Button button(String text, javafx.scene.Node image, javafx.scene.control.Tooltip tip, boolean isDefault, boolean isCancel, boolean hasMnemonic, javafx.event.EventHandler<javafx.event.ActionEvent> handler)
The handler may be specified as "this::handle" where "handle" is the name of the method to call (the class must implement the java.event.EventHandler interface) when this Button is activated by the user (e.g., using the keyboard, or mouse, or by touching the screen) or programatically.
text
- Button's label textimage
- Button's icon (use "null" if no icon)tip
- Button's Tooltip object (use "null" if no Tool tip)isDefault
- Specifies whether this is a "Default" buttonisCancel
- Specifies whether this is a "Cancel" buttonhasMnemonic
- Specifies whether to parse for Mnemonic character ("_")handler
- Button's ActionEvent handler (use "null" if no handler)public static javafx.scene.control.Button button(String text, String tip, boolean isDefault, boolean isCancel, boolean hasMnemonic, javafx.event.EventHandler<javafx.event.ActionEvent> handler)
The handler may be specified as "this::handle" where "handle" is the name of the method to call (the class must implement the java.event.EventHandler interface) when this Button is activated by the user (e.g., using the keyboard, or mouse, or by touching the screen) or programatically.
text
- Button's label texttip
- Button's Tool tip text (use "null" if no Tool tip)isDefault
- Specifies whether this is a "Default" buttonisCancel
- Specifies whether this is a "Cancel" buttonhasMnemonic
- Specifies whether to parse for Mnemonic character ("_")handler
- Button's ActionEvent handler (use "null" if no handler)public static javafx.scene.control.Button[] buttons(boolean hasMnemonic, String... s)
hasMnemonic
- Specifies whether to parse for Mnemonic character ("_")s
- Any number of Strings to convert into Button objectspublic static javafx.scene.control.ButtonBase fireMnemonic(char c, javafx.scene.control.ButtonBase... bB)
c
- Character to match (case-insensitive)bB
- Any number of ButtonBase objects to cross-checkpublic static javafx.scene.control.ButtonBase fireMnemonic(javafx.scene.input.KeyEvent k, javafx.scene.control.ButtonBase... bB)
k
- KeyEvent to match (case-insensitive)bB
- Any number of ButtonBase objects to cross-checkpublic static char getMnemonic(javafx.scene.control.Labeled text)
Note: The character returned is converted to lower case using the java.lang.Character.toLowerCase() method because mnemonics are interpreted by Java in a case-insensitive manner.
text
- The Labeled object that may contain a mnemonic sequencepublic static char getMnemonic(String s)
Note: The character returned is converted to lower case using the java.lang.Character.toLowerCase() method because mnemonics are interpreted by Java in a case-insensitive manner.
s
- The String that may contain a mnemonic sequencepublic static <R extends javafx.scene.layout.Region> R setBackgroundColor(R r, javafx.scene.paint.Color bg)
r
- Region to modifybg
- The new background colourpublic static <R extends javafx.scene.layout.Region> R setColors(R r, javafx.scene.paint.Color bg, javafx.scene.paint.Color fg)
r
- Region to modifybg
- The new background colourfg
- The new foreground colourpublic static <R extends javafx.scene.layout.Region> R setForegroundColor(R r, javafx.scene.paint.Color fg)
For the Labeled class (or any of its sub-classes, such as Label), the setTextFill() method is used.
Region doesn't actually suppor this, so nothing gets changed, but we do support passing Region as a parameter anyway so that other sub-classes can be supported in the future more easily.
r
- Region to modifyfg
- The new foreground colour