Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. JavaFX doesn\'t provide you with UI elements, shapes and text. So you must al

ID: 3867724 • Letter: 1

Question

1. JavaFX doesn't provide you with UI elements, shapes and text. So you must always create your own graphics. O True O False 2. An Image is an object that describes the location of a graphics file. O True O False 3. When you write code for MouseEvents, you are telling a Node to listen for a particular event O True False 4. Audio can be played by referencing the Audio object directly. C True O False 5. Which method is used to for mouse click events? O setonMouseDraggedO O setonMouseReleasedo O setonMouseMovedo OsetonMouseClickedo

Explanation / Answer

1. False

       Because The JavaFX UI controls are built by using nodes in the scene graph. Therefore, the controls can use the visually rich features of the JavaFX platform. Because the JavaFX APIs are fully implemented in Java, you can easily integrate the JavaFX UI controls into your existing Java applications.

Example 1-1 Creating an Animated Button

import javafx.animation.KeyFrame;

import javafx.animation.KeyValue;

import javafx.animation.Timeline;

import javafx.util.Duration;

import javafx.scene.control.Button;

import javafx.scene.text.Font;

import javafx.scene.effect.Reflection;

...

Button button = new Button();

button.setText("OK");

button.setFont(new Font("Tahoma", 24));

button.setEffect(new Reflection());

final Timeline timeline = new Timeline();

timeline.setCycleCount(Timeline.INDEFINITE);

timeline.setAutoReverse(true);

final KeyValue kv = new KeyValue(button.opacityProperty(), 0);

final KeyFrame kf = new KeyFrame(Duration.millis(600), kv);

timeline.getKeyFrames().add(kf);

timeline.play();

...

2. True

     The Image class represents graphical images and is used for loading images from a specified URL.

3. True

     

4 . False

     Based on uri.getScheme() == null, I assume you need to provide a URI for the sound file, instead of just a filename."The source must represent a valid URI and is immutable. Only HTTP, FILE, and JAR URLs are supported."

5. setMouseClicked()

    to add a mouse event listener to a button, you can use the convenience method setOnMouseClicked() as shown below.

playButton.setOnMouseClicked((new EventHandler<MouseEvent>() {
   public void handle(MouseEvent event) {
      System.out.println("Hello World");
      pathTransition.play();
   }
}));

6 a) setStrokeWidth()

7 option b ie 2nd

    it should have 4 parameters

8. c yellow

9. true

10. c   Color.rgb(0,255,255);

11. True  
       start(Stage primaryStage)
       The main entry point for all JavaFX applications.

12. True

13. option c) 3   

14. a option 1

     because ScrollPane() is the node

15 True