import java.net.URISyntaxException; import javafx.animation.TranslateTransition; import javafx.animation.TranslateTransitionBuilder; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Control; import javafx.scene.control.TextField; import javafx.scene.layout.HBoxBuilder; import javafx.scene.layout.Pane; import javafx.stage.Stage; /** * * @author mrkam */ public class Bug extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws URISyntaxException { System.out.println("javafx.runtime.version = " + System.getProperty("javafx.runtime.version")); final Button defaultButton = new Button("Cancel"); defaultButton.setDefaultButton(true); defaultButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent arg0) { System.out.println("Default button action invoked"); } }); final Button cancelButton = new Button("Cancel"); cancelButton.setCancelButton(true); cancelButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent arg0) { System.out.println("Cancel button action invoked"); } }); Button removeCancelButton = new Button("remove buttons"); TextField textField = new TextField("Press Enter here, don't press ESC here"); textField.setPrefWidth(300); final Pane root = HBoxBuilder.create() .children(defaultButton, cancelButton, removeCancelButton, textField) .build(); removeCancelButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent arg0) { root.getChildren().remove(cancelButton); root.getChildren().remove(defaultButton); } }); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } }