Question: btCancel.setOnAction ( handler ) ; HBox pane = new HBox ( 5 ) ; pane.getChildren ( ) . addAll ( btOK , btCancel ) ;

btCancel.setOnAction(handler);
HBox pane = new HBox(5);
pane.getChildren(). addAll(btOK, btCancel);
Scene scene = new Scene(pane,200,250);
primaryStage.etTitle("Test"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
??*****
The main method is only needed for the IDE with limited JavaFX
support. Not needed for running from the command line.
***?
public static void main(String[] args){
launch(args);
}
}
q,
The program has a runtime error, because the handler is registered with more than one source.
When clicking the OK button, the program displays The OK button is clicked.
When clicking either button, the program displays The OK button is clicked twice.
When clicking the Cancel button, the program displays The OK button is clicked.
btCancel.setOnAction ( handler ) ; HBox pane =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!