Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

24. Analyze the following code: import javafx.application Application import javafx.scene.Scene; import javafx.scene.layout.HBox import javafx.scene.layout.Pane import javafx-geometry.Insets; import javafx.stage.Stage import javafk.scene.image.lmage import javafx.scene.image.lmageView; public class Test

image text in transcribed
image text in transcribed
24. Analyze the following code: import javafx.application Application import javafx.scene.Scene; import javafx.scene.layout.HBox import javafx.scene.layout.Pane import javafx-geometry.Insets; import javafx.stage.Stage import javafk.scene.image.lmage import javafx.scene.image.lmageView; public class Test extends Application ( @overrideI/ Override the start method in the Application class public void start(Stage primaryStage) ( // Create a pane to hold the image views Pane pane new HBox(10) pane.setPadding(new Insets(5, 5, 5, 5)): Image image - new Image("www.cs.armstrong.edu/liang/image/us.gif") pane.getChildren).addAll(new ImageView(image), new ImageView image) // Create a scene and place it in the stage Scene scene new Scene(pane); primaryStage.setTitle("Showlmage":I/Set the stage title primaryStage.setScene(scene);// Place the scene in the stage primaryStage.show):/ Display the stage 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/Stringl)l args) launch(args); a. The program runs fine and displays two images. b. new Imaget"www.cs.armstrong.edu/liang/image/us.gif") must be replaced by new Image("http://www.cs.armstrong.edu/liang/image/us-gif") c. The image object cannot be shared by two ImageViews. d. The addAll method needs to be replaced by the add method. 2s A avakx action event handler is an instance of Atin 26 AJaNafx action event handler contains a method a publie veokd actionPerformed(ActionEvent e) a pablie void actionPerformed(Event e) c publie void handlejActionEvent e d public void handle(Event e) 27. To register a source for an action event with a handler, use 28 Suppose A is an anonymous inner class in Test. A is compiled into a file named a. Aclass c. ASTest.class e. Test&1.class 29. Which of the following statements are true? a. Inner classes can make programs simple and concise. b. An inner class can be declared public or private subject to the same visibility rules applied toa member of the class. c. An inner class can be declared static. A static inner class can be accessed using the outer class name. A static inner class cannot access nonstatic members of the outer class. d. An inner class supports the work of its containing outer class and is compiled into a class named e. All of the above. 30. Which statement is true about a non-static inner class? a. It must implement an interface b. It is accessible from any other class. c. It can only be instantiated in the enclosing class d. It must be final if it is declared in a method scope. e. It can access private instance variables in the enclosing object

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_2

Step: 3

blur-text-image_3

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions