-
Bug
-
Resolution: Fixed
-
P3
-
8
-
8.0b86
I was observing code of listener removing :
private void setDefaultButton(boolean value) {
KeyCode acceleratorCode = KeyCode.ENTER;
defaultAcceleratorKeyCodeCombination =
new KeyCodeCombination(acceleratorCode);
if (! value) {
Runnable oldDefault = getSkinnable().getParent().getScene().getAccelerators().get(defaultAcceleratorKeyCodeCombination);
if (!defaultButtonRunnable.equals(oldDefault)) { getSkinnable().getParent().getScene().getAccelerators().remove(defaultAcceleratorKeyCodeCombination);
}
}
getSkinnable().getParent().getScene().getAccelerators().put(defaultAcceleratorKeyCodeCombination, defaultButtonRunnable);
}
suppose, we call it with false:
setDefaultButton(false);
if (!false) -> true
we get oldDefault. if the current button is oldDefault then false, and we don't remove.
So, I cannot remove default button dehavior. The same for cancel behavior.
To reproduce, run the attached application.
The default button is button.
Click enter in text field. Default button fires and becomes not default. Press again, and it is fired again.
private void setDefaultButton(boolean value) {
KeyCode acceleratorCode = KeyCode.ENTER;
defaultAcceleratorKeyCodeCombination =
new KeyCodeCombination(acceleratorCode);
if (! value) {
Runnable oldDefault = getSkinnable().getParent().getScene().getAccelerators().get(defaultAcceleratorKeyCodeCombination);
if (!defaultButtonRunnable.equals(oldDefault)) { getSkinnable().getParent().getScene().getAccelerators().remove(defaultAcceleratorKeyCodeCombination);
}
}
getSkinnable().getParent().getScene().getAccelerators().put(defaultAcceleratorKeyCodeCombination, defaultButtonRunnable);
}
suppose, we call it with false:
setDefaultButton(false);
if (!false) -> true
we get oldDefault. if the current button is oldDefault then false, and we don't remove.
So, I cannot remove default button dehavior. The same for cancel behavior.
To reproduce, run the attached application.
The default button is button.
Click enter in text field. Default button fires and becomes not default. Press again, and it is fired again.