(a)publicclass Testextends Application {publicvoid start(Stage stage) { Button btOK =new Button("OK"); }privateclass Handlerimplements EventHandler<ActionEvent> {publicvoid handle(Action e) { System.out.println(e.getSource()); } }}(b)publicclass Testextends Application {publicvoid start(Stage stage) { Button btOK =new Button("OK"); btOK.setOnAction(new EventHandler<ActionEvent> {publicvoid handle(ActionEvent e) { System.out.println(e.getSource()); } }// Something missing here }}
circlePane.setOnKeyPressed(e -> System.out.println("Key pressed " + e.getCode()));circlePane.setOnKeyTyped(e -> System.out.println("Key typeed " + e.getCode()));