Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. What is the output of the following code? import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; public class Test { public static void main(String[] args) { IntegerProperty d1

1. What is the output of the following code? import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; public class Test { public static void main(String[] args) { IntegerProperty d1 = new SimpleIntegerProperty(1); IntegerProperty d2 = new SimpleIntegerProperty(2); d1.bind(d2); System.out.print("d1 is " + d1.getValue() + " and d2 is " + d2.getValue()); d2.setValue(3); System.out.println(", d1 is " + d1.getValue() + " and d2 is " + d2.getValue()); } }

a. d1 is 2 and d2 is 2, d1 is 2 and d2 is 3

b. d1 is 1 and d2 is 2, d1 is 3 and d2 is 3

c. d1 is 1 and d2 is 2, d1 is 1 and d2 is 3

d. d1 is 2 and d2 is 2, d1 is 3 and d2 is 3

2. The statement for registering a listener for processing list view item change is ________

a. lv.addListener(e -> {processStatements});

b. lv.getSelectionModel().selectedItemProperty().addListener(e -> {processStatements});

c. lv.getItems().addListener(e -> {processStatements});

d. lv.getSelectionModel().addListener(e -> {processStatements});

3. *Which of the following statements are true?

A source object fires an event.

A handler object fires an event

A handler is registered with the source object for processing the event

Any object such a String object can fire an event

4.Suppose a JavaFX class has a binding property named weight of the type DoubleProperty. By convention, which of the following methods are defined in the class?

public DoubleProperty weightProperty()

public double getWeight()

public DoubleProperty WeightProperty()

public double weightProperty()

public void setWeight(double v)

5. Every JavaFX main class ________.

extends javafx.application.Application

overrides start() method

overrides start(Stage s) method

implements javafx.application.Application

6. Which of the following can be used as a source for a binding properties?

DoubleProperty

IntegerProperty

String

Double

Integer

7. The setOnAction method is defined in ________.

a.Labelled

b. Button

c. ButtonBase

d. Label

e. Node

8. Suppose the following program displays a pane in the stage. What is the output if the user presses the key for letter K?

// import javafx classes omitted public class Test extends Application { @Override public void start(Stage primaryStage) { // Code to create and display pane omitted pane.setOnKeyPressed(e -> System.out.print("Key pressed " + e.getCode() + " ")); pane.setOnKeyTyped(e -> System.out.println("Key typed " + e.getCode())); } }

a. Key pressed K Key typed UNDEFINED

b. Key pressed K

c. Key pressed K Key typed

d. Key typed UNDEFINED

9. To add two nodes node1 and node2 into a pane, use ________.

a. pane.add(node1, node2)

b. pane.getChildren().addAll(node1, node2);

c. pane.getChildren().add(node1, node2);

d. pane.addAll(node1, node2);

10. Which of the following statements are true?

a. A Node can be placed in a Scene

b. A Shape can be placed in a Control.

c. A Node can be placed in a Pane

d. A Pane can be placed in a Control.

11. Suppose A is an anonymous inner class in Test. A is compiled into a file named ________.

a. A$Test.class

b.Test$A.class

c. Test&1.class

d. Test$1.class

e. A.class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions