Deck 25: JavaFX
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/26
Play
Full screen (f)
Deck 25: JavaFX
1
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.
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.
D
2
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.
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.
C
3
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.An image's aspect ratio is the ratio of the image's width to its height.
D)To specify an ImageView's size,set its Fit Width and Fit Height properties in the Inspector's Layout section.
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.An image's aspect ratio is the ratio of the image's width to its height.
D)To specify an ImageView's size,set its Fit Width and Fit Height properties in the Inspector's Layout section.
B
4
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.
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 26 flashcards in this deck.
Unlock Deck
k this deck
5
A VBox's ________ determines the layout positioning of its children.
A)margin
B)padding
C)calibration
D)alignment
A)margin
B)padding
C)calibration
D)alignment
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
6
The window in which a JavaFX app's GUI is displayed is known as the________.
A)main window
B)stage
C)podium
D)rostrum
A)main window
B)stage
C)podium
D)rostrum
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
7
NetBeans creates three files for a JavaFX FXML Application project-an 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
A)view
B)model
C)main
D)controller
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
8
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
A)apps
B)applications
C)controls
D)files
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
9
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
A)view
B)model
C)controller
D)data
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
10
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)Java's GUI,graphics and multimedia API of the future is Swing.
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)Java's GUI,graphics and multimedia API of the future is Swing.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
11
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.
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 26 flashcards in this deck.
Unlock Deck
k this deck
12
A JavaFX app's main class directly inherits from ________.
A)Main
B)Application
C)App
D)Object
A)Main
B)Application
C)App
D)Object
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
13
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
D)Root
A)FXML
B)GUI
C)Projects
D)Root
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
14
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.
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 26 flashcards in this deck.
Unlock Deck
k this deck
15
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.
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.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
16
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.
A)margin
B)spacing.
C)padding.
D)None of the above.
A)margin
B)spacing.
C)padding.
D)None of the above.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
17
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 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.
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 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 26 flashcards in this deck.
Unlock Deck
k this deck
18
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.
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 26 flashcards in this deck.
Unlock Deck
k this deck
19
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 class that implements the event-listener interface will be created for you and will call the method you specify.
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 class that implements the event-listener interface will be created for you and will call the method you specify.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
20
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
A)base
B)root
C)origin
D)start
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
21
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).
A)percentage formats
B)locale-specific currency
C)a)and b)
D)Neither a)nor b).
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
22
Stage method show displays the ________.
A)Stage window
B)scene graph
C)root node
D)title bar
A)Stage window
B)scene graph
C)root node
D)title bar
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
23
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.
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.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
24
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
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 26 flashcards in this deck.
Unlock Deck
k this deck
25
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.
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 26 flashcards in this deck.
Unlock Deck
k this deck
26
A JavaFX Button's event handler receives a(n)________,which indicates that the Button was clicked.
A)ButtonEvent
B)ObjectEvent
C)ControlEvent
D)ActionEvent
A)ButtonEvent
B)ObjectEvent
C)ControlEvent
D)ActionEvent
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck