Suppose the following program displays a pane in the stage. What is the output if the user presses the key for letter B?
```
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
// import javafx classes omitted
public class Test1 extends Application {
@Override
public void start(Stage primaryStage) {
// Code to create and display pane omitted
Pane pane = new Pane();
Scene scene = new Scene(pane, 200, 250);
primaryStage.setTitle("MyJavaFX"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
pane.requestFocus();
pane.setOnKeyPressed(e ->
System.out.print("Key pressed " + e.getCode() + " "));
pane.setOnKeyTyped(e ->
System.out.println("Key typed " + e.getCode()));
}
/**
* 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);
}
}
```
a. Key pressed B Key typed UNDEFINED
b. Key pressed B Key typed
c. Key typed UNDEFINED
d. Key pressed B
a. Key pressed B Key typed UNDEFINED
You might also like to view...
The process of determining what is not working in code is called ____________________.
Fill in the blank(s) with the appropriate word(s).
The ________ image file format is used primarily for photographic images
Fill in the blank(s) with correct word
Which type of information system supports companies as whole?
A. Transactions processing system B. Inter-organization information system C. Management information system D. Decision support system E. None of the above
The throws clause of a method:
a. specifies the exceptions a method catches. b. specifies the exceptions thrown by the calling method. c. specifies the exceptions a method throws. d. specifies the exceptions a method throws and catches.