Programming Languages Chapter 25 The Space Between Nodes Contents

subject Type Homework Help
subject Pages 8
subject Words 42
subject Authors Harvey Deitel, Paul Deitel

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Chapter 25: JavaFX
25.1 Q1: Which of the following statements is false?
a. A graphical user interface (GUI) presents a user-friendly mechanism for interacting
with an app. A GUI (pronounced GOO-ee) gives an app a distinctive look-and-feel.
b. GUIs are built from GUI componentssometimes called controls or widgets.
c. Providing different apps with consistent, intuitive user-interface components gives
users a sense of familiarity with a new app, so that they can learn it more quickly and use
it more productively.
d. Java’s GUI, graphics and multimedia API of the future is Swing.
25.2 Q1: Which of the following statements is false?
a. JavaFX Scene Builder is a standalone JavaFX GUI visual layout tool that can also be
used with various IDEs.
b. JavaFX Scene Builder enables you to create GUIs by dragging and dropping GUI
components from Scene Builder’s library onto a design area, then modifying and styling
the GUIall without writing any code.
c. The FXML code is integrated with the program logic that’s defined in Java source
codethis integration of the interface (the GUI) with the implementation (the Java code)
makes it easier to debug, modify and maintain JavaFX GUI apps.
d. JavaFX Scene Builder generates FXML (FX Markup Language)an XML vocabulary
for defining and arranging JavaFX GUI controls without writing any Java code.
25.3 Q1: The window in which a JavaFX app’s GUI is displayed is known as
the________.
a. main window
b. stage
c. podium
d. rostrum
page-pf2
25.3 Q2: Which of the following statements is false?
a. A JavaFX GUI is defined as a scene graph—a tree structure of an app’s visual
elements, such as GUI controls, shapes, images, video, text and more.
b. Each visual element in the scene graph is a nodean instance of a subclass of Node
(package javafx.scene), which defines common attributes and behaviors for all nodes
in the scene graph.
c. The first node in the scene graph is known as the origin.
d. Nodes that have children are typically layout containers that arrange their child nodes
in the scene.
25.3 Q3: Which of the following statements is false?
a. The nodes arranged in a layout container are a combination of controls and possibly
other layout containers.
b. When the user interacts with a control, it generates an event. Programs can use event
handling to specify what should happen when each user interaction occurs.
c. An event handler is a method that responds to a user interaction. An FXML GUI’s
event handlers are defined in a controller class.
d. All of the above statements are true.
25.4.1 Q1: To create an app in NetBeans, you must first create a project, i.e., a group of
related ________, such as code and images that make up an app.
a. apps
b. applications
c. controls
d. files
25.4.2 Q1: The NetBeans ________ window provides access to all of your projects.
Within a project’s node, the contents are organized into folders and files.
a. FXML
b. GUI
c. Projects
page-pf3
d. Root
25.4.2 Q2: NetBeans creates three files for a JavaFX FXML Application projectan
FXML markup file for the GUI, a file containing the app’s main class and a file
containing the app’s ________ class.
a. view
b. model
c. main
d. controller
25.4.5 Q1: Layout containers help you arrange GUI components. A VBox arranges its
nodes________.
a. left to right
b. by best fit
c. vertically from top to bottom
d. None of the above.
25.4.5 Q2: To make a layout container the ________ node in a scene graph, select the
layout container, then select Scene Builder’s Edit > Trim Document to Selection
menu item.
a. base
b. root
c. origin
d. start
25.4.6 Q1: A VBox’s ________ determines the layout positioning of its children.
a. margin
b. padding
c. calibration
page-pf4
d. alignment
25.4.7 Q1: Which of the following statements is false?
a. You can set a Labels text either by double clicking it and typing the text, or by
selecting the Label and setting its Text property in the Inspector’s Properties section.
b. When adding controls to a VBox, each new control is placed adjacent to the preceding
ones by default.
c. To set the image to display, select the ImageView then set its Image property in the
Inspector’s Properties section. An image’s aspect ratio is the ratio of the image’s
width to its height.
d. To specify an ImageViews size, set its Fit Width and Fit Height properties in the
Inspector’s Layout section.
25.5.2 Q1: A JavaFX app’s main class directly inherits from ________.
a. Main
b. Application
c. App
d. Object
page-pf5
25.5.2 Q2: Which of the following statements is false?
a. Each cell in a GridPane can be empty or can hold one or more JavaFX components,
including layout containers that arrange other controls.
b. Each component in a GridPane can span multiple columns or rows.
c. A TextField (package javafx.scene.control) can accept text input or display text.
d. A Slider (package javafx.scene.control) represents a value in the range 0.01.0
by default and allows the user to select a number in that range by moving the Slider’s
thumb.
0.01.0 by default and allows the user to select a number in that range by moving
25.5.2 Q3: Which of the following statements is false?
a. When the user interacts with a GUI component, the interactionknown as an event
drives the program to perform a task.
b. For events that occur when the value of a control’s property changes, you must create
the event handler entirely using only drag and drop in Scene Builder.
c. The code that performs a task in response to an event is called an event handler.
d. For certain events you can link a control to its event-handling method by using the
Code section of Scene Builder’s Inspector window. In this case, the class that
implements the event-listener interface will be created for you and will call the method
you specify.
25.5.2 Q4: Which of the following statements is false?
a. JavaFX applications in which the GUI is implemented as FXML adhere to the Model-
View-Controller (MVC) design pattern, which separates an app’s data (contained in the
model) from the app’s GUI (the view) and the app’s processing logic (the controller).
b. The model presents the data stored in the view.
c. When a user provides input, the controller modifies the model with the given input.
d. When the model changes, the controller updates the view to present the changed data.
25.5.2 Q5: In a JavaFX FXML app, you define the app’s event handlers in a________
class, which defines instance variables for interacting with controls programmatically, as
well as event-handling methods.
a. view
b. model
c. controller
d. data
page-pf6
25.5.3 Q1: Which of the following statements is false?
a. You can set a Button’s text by double clicking it, or by selecting the Button, then
setting its Text property in the Inspector window’s Properties section.
b. A GridPane column’s contents are left-aligned by default.
c. Setting a node’s Pref Width property of a GridPane column to USE_COMPUTED_SIZE
indicates that the width should be based on the widest child.
d. All of the above are true.
25.5.3 Q2: The space between a node’s contents and its top, right, bottom and left edges
is known as the ________, which separates the contents from the node’s edges.
25.5.3 Q3: Which of the following statements is false?
a. You can specify the default amount of space between a GridPane’s columns and rows
with its Hgap (horizontal gap) and Vgap (vertical gap) properties, respectively.
b. You can type in a TextField only if it’s “in focus”—that is, it’s the control that the
user is interacting with.
c. When you click an interactive control, it prompts for input.
d. When you press the Tab key, the focus transfers from the current focusable control to
the next onethis occurs in the order the controls were added to the GUI.
25.5.4 Q1: Which of the following statements is false?
a. To display a GUI, you must attach it to a Scene, then attach the Scene to the Stage
that’s passed into Application method start.
b. By default, the Scene’s size is determined by the size of the scene graph.
c. Overloaded versions of the Scene constructor allow you to specify the Scene’s size
and fill (a color, gradient or image).
d. Scene method setTitle specifies the text that appears in the Stage window’s title bar.
page-pf7
25.5.4 Q2: Stage method setScene places________.
a. the root node
b. text in the Stage window's title bar
c. the gradient on the Stage
d. a Scene onto a Stage
25.5.4 Q3: Stage method show displays the ________.
a. Stage window
b. scene graph
c. root node
d. title bar
25.5.5 Q1: Class NumberFormat of package java.text provides numeric formatting
capabilities, such as locale-specific currency and percentage formats.
a. percentage formats
b. locale-specific currency
c. a) and b)
d. Neither a) nor b).
25.5.5 Q2: A JavaFX Button’s event handler receives a(n) ________, which indicates
that the Button was clicked.
a. ButtonEvent
b. ObjectEvent
c. ControlEvent
d. ActionEvent
25.5.5 Q3: Which of the following statements is false?
a. As of Java SE 8, an anonymous inner class can access its top-level class’s instance
variables, static variables and methods, but has limited access to the local variables of
the method in which it’s declared—it can access only the final local variables declared
in the enclosing method’s body.
b. The @FXML annotation preceding an instance variable indicates that the variable’s name
can be used in the FXML file that describes the app’s GUI.
c. An anonymous inner class is a class that’s declared without a name and typically
appears inside a method declaration.
d. Since an anonymous inner class has no name, one object of the class must be created at
the point where the class is declared.
page-pf8

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.