Deck 12: Javafx Graphical User Interfaces

Full screen (f)
exit full mode
Question
A JavaFX app's main class directly inherits from ________.

A) Main
B) Application
C) App
D) Object
Use Space or
up arrow
down arrow
to flip the card.
Question
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.
Question
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.
Question
Which of the following statements is false?

A) When the user interacts with a GUI component, the interaction-known 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 event-listener interface is implemented for you to call the method that you specify.
Question
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.
Question
Which of the following statements is false?

A) A JavaFX GUI's scene graph is 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 node-an 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.
Question
The window in which a JavaFX app's GUI is displayed is known as the________.

A) main window
B) stage
C) podium
D) rostrum
Question
Class NumberFormat of package java.text provides numeric formatting capabilities, such as ________.

A) percentage formats
B) locale-specific currency formats
C) a) and b)
D) Neither a) nor b).
Question
Stage method show displays the ________.

A) Stage window
B) scene graph
C) root node
D) title bar
Question
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.
Question
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 one-this occurs in the order the controls were added to the GUI.
Question
A VBox's ________ determines the layout positioning of its children.

A) margin
B) padding
C) calibration
D) alignment
Question
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
Question
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 GUI-all without writing any code.
C) The FXML code is integrated with the program logic that's defined in Java source code-this 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.
Question
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
Question
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.0-1.0 by default and allows the user to select a number in that range by moving the Slider's thumb.
Question
Which of the following statements is false?

A) To add a VBox to Scene Builder's content panel, double-click VBox in the Library window's Containers section.
B) You also can copy and paste a VBox from the Containers section in the Library onto Scene Builder's content panel.
C) You also can drag-and-drop a VBox from the Containers section in the Library onto Scene Builder's content panel.
D) All of the above statements are true.
Question
Which of the following statements is false?

A) You can set a Label's 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.
D) To specify an ImageView's size, set its Fit Width and Fit Height properties in the Inspector's Layout section.
Question
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 components-sometimes 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) All of the above statements are true.
Question
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.
Question
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.
Question
A JavaFX Button's event handler receives a(n) ________, which indicates that the Button was clicked.

A) ButtonEvent
B) ObjectEvent
C) ControlEvent
D) ActionEvent
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/22
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 12: Javafx Graphical User Interfaces
1
A JavaFX app's main class directly inherits from ________.

A) Main
B) Application
C) App
D) Object
Application
2
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.
B
3
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.
D
4
Which of the following statements is false?

A) When the user interacts with a GUI component, the interaction-known 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 event-listener interface is implemented for you to call the method that you specify.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
5
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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following statements is false?

A) A JavaFX GUI's scene graph is 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 node-an 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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
7
The window in which a JavaFX app's GUI is displayed is known as the________.

A) main window
B) stage
C) podium
D) rostrum
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
8
Class NumberFormat of package java.text provides numeric formatting capabilities, such as ________.

A) percentage formats
B) locale-specific currency formats
C) a) and b)
D) Neither a) nor b).
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
9
Stage method show displays the ________.

A) Stage window
B) scene graph
C) root node
D) title bar
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
10
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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
11
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 one-this occurs in the order the controls were added to the GUI.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
12
A VBox's ________ determines the layout positioning of its children.

A) margin
B) padding
C) calibration
D) alignment
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
13
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
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
14
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 GUI-all without writing any code.
C) The FXML code is integrated with the program logic that's defined in Java source code-this 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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
15
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
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
16
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.0-1.0 by default and allows the user to select a number in that range by moving the Slider's thumb.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following statements is false?

A) To add a VBox to Scene Builder's content panel, double-click VBox in the Library window's Containers section.
B) You also can copy and paste a VBox from the Containers section in the Library onto Scene Builder's content panel.
C) You also can drag-and-drop a VBox from the Containers section in the Library onto Scene Builder's content panel.
D) All of the above statements are true.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
18
Which of the following statements is false?

A) You can set a Label's 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.
D) To specify an ImageView's size, set its Fit Width and Fit Height properties in the Inspector's Layout section.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
19
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 components-sometimes 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) All of the above statements are true.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
20
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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
21
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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
22
A JavaFX Button's event handler receives a(n) ________, which indicates that the Button was clicked.

A) ButtonEvent
B) ObjectEvent
C) ControlEvent
D) ActionEvent
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 22 flashcards in this deck.