Question: java program Complete the following sample event program. package application; import javafx.application.Application; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.input.KeyEvent; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public
java program Complete the following sample event program. package application; import javafx.application.Application; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.input.KeyEvent; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) { try { GridPane root = new GridPane(); Scene scene = new Scene(root,400,400); TextField textField1 = new TextField(); textField1.setPromptText("Type here"); TextField textField2 = new TextField(); textField2.setPromptText("Type here"); final EventHandler
The program should intercept the keys F1, F2 and F3 and a corresponding message output. After recognition, a corresponding text is written in textField2. All other keys are ignored.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
