Question
JAVA 1 of 2: Modul 04 Which statements are right about a JavaFX class? - several alternatives possible Any JavaFX class 1 . inherit Application
JAVA 1 of 2: Modul 04
Which statements are right about a JavaFX class? - several alternatives possible
Any JavaFX class
1 . inherit Application
2. must use a layout class
3. override the start () method
4. must have a main () method
Which of these are layout containers? - several alternatives possible
1 . Shape
2. FlowPane
3. HBox
4. Control
5. BorderPane
Which statements are correct? - several alternatives possible
1. An stage is available at the start of a JavaFX application
2. You can have several stages in a JavaFX application
3. A stage is displayed using the show () method
4. A scene is inserted into a stage using the addScene () method
Study the following code:
public void start(Stage primaryStage) { HBox pane = new HBox(5); Circle circle = new Circle(50, 200, 200); pane.getChildren().addAll(circle); circle.setCenterX(100); circle.setCenterY(100); circle.setRadius(50); pane.getChildren().addAll(circle); // Create a scene and place it in the stage Scene scene = new Scene(pane); primaryStage.setTitle("Test"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
1. The program has a compilation error because the Circle object is added twice
2. The program has a runtime error because the Circle object is added twice
3. Programs run fine and show a circle
4. The program runs fine and shows two circles
A JavaFX action event handler is an instance of
1. ActionEvent
2. Action
3. EventHandler
4. EventHandler
A JavaFX action event handler has a method
1. public void actionPerformed(ActionEvent e)
2. public void actionPerformed(Event e)
3. public void handle(ActionEvent e)
4. public void handle(Event e)
To connect the source to an event listener for an action event, use
1. source.addAction(handler)
2. source.setOnAction(handler)
3. source.addOnAction(handler)
4. source.setActionHandler(handler)
Which of the following code lines is a correct implementation of linking a trader with a button btOK? - several alternatives possible
1. btOK.setOnAction(e -> System.out.println("Handle the event"));
2. btOK.setOnAction((e) -> System.out.println("Handle the event"));
3. btOK.setOnAction((ActionEvent e) -> System.out.println("Handle the event"));
4. btOK.setOnAction(e -> {System.out.println("Handle the event");});
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started