Java Program
INclude 5 changes to the program below and explain what changes you added. Be creative
AnonymousHandlerDemo.java
import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox; import javafx.stage.Stage; public class AnonymousHandlerDemo extends Application { @Override // Override the start method in the Application class public void start(Stage primaryStage) { // Hold two buttons in an HBox HBox hBox = new HBox(); hBox.setSpacing(10); hBox.setAlignment(Pos.CENTER); Button btNew = new Button("New"); Button btOpen = new Button("Open"); Button btSave = new Button("Save"); Button btPrint = new Button("Print"); hBox.getChildren().addAll(btNew, btOpen, btSave, btPrint); // Create and register the handler btNew.setOnAction(new EventHandler() { @Override // Override the handle method public void handle(ActionEvent e) { System.out.println("Process New"); } }); btOpen.setOnAction(new EventHandler() { @Override // Override the handle method public void handle(ActionEvent e) { System.out.println("Process Open"); } }); btSave.setOnAction(new EventHandler() { @Override // Override the handle method public void handle(ActionEvent e) { System.out.println("Process Save"); } }); btPrint.setOnAction(new EventHandler() { @Override // Override the handle method public void handle(ActionEvent e) { System.out.println("Process Print"); } }); // Create a scene and place it in the stage Scene scene = new Scene(hBox, 300, 50); primaryStage.setTitle("AnonymousHandlerDemo"); // Set title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage } }
To describe events, event sources, and event classes ( 15.2). To define handler classes, register handler objects with the source object, and write the code to handle events ( 15.3). To define handler classes using inner classes ( 15.4). To define handler classes using anonymous inner classes ( 15.5). To simplify event handling using lambda expressions ( 15.6). To develop a GUI application for a loan calculator ( 15.7). To write programs to deal with MouseEvents ( 15.8). To write programs to deal with KeyEvents ( 15.9). To create listeners for processing a value change in an observable objectGB To use the Animation. Pat Transition. FadeTransition, and Timeline classesto develop animations ( 1511). To develop an animation for simulating a bouncing ball ( 15.12). ). To describe events, event sources, and event classes ( 15.2). To define handler classes, register handler objects with the source object, and write the code to handle events ( 15.3). To define handler classes using inner classes ( 15.4). To define handler classes using anonymous inner classes ( 15.5). To simplify event handling using lambda expressions ( 15.6). To develop a GUI application for a loan calculator ( 15.7). To write programs to deal with MouseEvents ( 15.8). To write programs to deal with KeyEvents ( 15.9). To create listeners for processing a value change in an observable objectGB To use the Animation. Pat Transition. FadeTransition, and Timeline classesto develop animations ( 1511). To develop an animation for simulating a bouncing ball ( 15.12). )