Scene should have the ability to have a default action button, and a default cancel button.
Default Buttons are useful in dialogs to allow a user take a default action without having to navigate to the Button.
Default Action :
If an action key (VK_SPACE) reaches the Scene unconsumed, and the Scene has a default action button,
then the default Button's action listeners will be notified.
To achieve this we need to add a boolean property, defaultButton, to javafx.scene.controls.Button
This will give us two new public methods in Button.
void Button.setDefaultButton(boolean value); // to set/remove a default Button
boolean Button.isDefaultButton(); // to check is a Button is the default Button :
Default Cancel :
If an action key (VK_ESCAPE) reaches the Scene unconsumed, and the Scene has a default cancel button,
then the Cancel Button's action listeners will be notified.
To achieve this we need to add a boolean property, cancelButton, to javafx.scene.controls.Button
This will give us two new public methods in Button.
void Button.setCancelButton(boolean value); // to set/remove a cancel Button
boolean Button.isCancelButton(); // to check is a Button is the cancel Button :
Default Buttons are useful in dialogs to allow a user take a default action without having to navigate to the Button.
Default Action :
If an action key (VK_SPACE) reaches the Scene unconsumed, and the Scene has a default action button,
then the default Button's action listeners will be notified.
To achieve this we need to add a boolean property, defaultButton, to javafx.scene.controls.Button
This will give us two new public methods in Button.
void Button.setDefaultButton(boolean value); // to set/remove a default Button
boolean Button.isDefaultButton(); // to check is a Button is the default Button :
Default Cancel :
If an action key (VK_ESCAPE) reaches the Scene unconsumed, and the Scene has a default cancel button,
then the Cancel Button's action listeners will be notified.
To achieve this we need to add a boolean property, cancelButton, to javafx.scene.controls.Button
This will give us two new public methods in Button.
void Button.setCancelButton(boolean value); // to set/remove a cancel Button
boolean Button.isCancelButton(); // to check is a Button is the cancel Button :
- duplicates
-
JDK-8108576 Default button does not receive enter key events
-
- Closed
-