Deck 13: Javafx Gui
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/20
Play
Full screen (f)
Deck 13: Javafx Gui
1
Which of the following statements is false?
A) Most things you can do in Scene Builder also can be accomplished in Java code.
B) To create a custom ListView cell format, you must first define a subclass of the ListCell that specifies how to create a ListView cell.
C) As the ListView displays items, it gets ListView cells from its cell factory.
D) You'll use the ListView's setCellFactory method to replace the default cell factory with one that returns objects of the ListCell subclass. You override this class's updateItem method to specify the cells' custom layout and contents.
A) Most things you can do in Scene Builder also can be accomplished in Java code.
B) To create a custom ListView cell format, you must first define a subclass of the ListCell that specifies how to create a ListView cell.
C) As the ListView displays items, it gets ListView cells from its cell factory.
D) You'll use the ListView's setCellFactory method to replace the default cell factory with one that returns objects of the ListCell subclass. You override this class's updateItem method to specify the cells' custom layout and contents.
A
2
The argument to ListView method setCellFactory is an implementation of interface ________ (package javafx.util). This generic interface provides a call method that receives one argument and returns an object of the custom ListCell<Type> subclass.
A) Call
B) getListCell
C) CallBack
D) None of the above.
A) Call
B) getListCell
C) CallBack
D) None of the above.
CallBack
3
Which of the following is most closely associated with the statement, "Occurs for a given node when the mouse exits that node's bounds."
A) onMouseDragReleased
B) onMouseExited
C) onMouseMoved d onMouseReleased
A) onMouseDragReleased
B) onMouseExited
C) onMouseMoved d onMouseReleased
B
4
Package javafx.collections defines ObservableList and other XE "observable collection" observable collection interfaces. The package also contains class ________, which provides static methods for creating and manipulating observable collections.
A) FXObservable
B) FXCreatObservable
C) FXObservableList
D) FXCollections
A) FXObservable
B) FXCreatObservable
C) FXObservableList
D) FXCollections
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
5
________ refers to the size and positioning of nodes in the XE "scene graph" scene graph.
A) Arrangement
B) Layout
C) Structure
D) Configuration
A) Arrangement
B) Layout
C) Structure
D) Configuration
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following statements is true?
A) A VBox's Spacing property specifies vertical spacing between its controls.
B) Setting a control's Max Width property to MAX_VALUE enables the control to fill its parent node's width.
C) A control's On Mouse Dragged event handler (located under the Mouse heading in the Code section) specifies what to do when the user drags the mouse on the control.
D) Each of these statements is true.
A) A VBox's Spacing property specifies vertical spacing between its controls.
B) Setting a control's Max Width property to MAX_VALUE enables the control to fill its parent node's width.
C) A control's On Mouse Dragged event handler (located under the Mouse heading in the Code section) specifies what to do when the user drags the mouse on the control.
D) Each of these statements is true.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
7
As you build a GUI, recall that it's often easier to manipulate layouts and controls via Scene Builder's ________ window than directly in the stage design area.
A) Inspector
B) Document
C) Controller
D) Library
A) Inspector
B) Document
C) Controller
D) Library
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
8
Each TextField has a text property that's returned by its textProperty method as a StringProperty. The StringProperty method ________ receives an XE "ObservableValue interface (JavaFX)" ObservableValue as an argument. When the ObservableValue changes, the bound property is updated accordingly.
A) tie
B) join
C) attach
D) bind
A) tie
B) join
C) attach
D) bind
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following statements is false?
A) A node's position should be defined relative to its XE "parent node" parent node and the other nodes in its parent.
B) JavaFX layout panes arrange nodes in a XE "scene graph" scene graph relative to one another, based on their sizes and positions.
C) Most JavaFX layout panes use absolute positioning-if a layout-pane node is resized, it adjusts its childrens' sizes and positions accordingly, based on their properties.
D) All of the above statements are true.
A) A node's position should be defined relative to its XE "parent node" parent node and the other nodes in its parent.
B) JavaFX layout panes arrange nodes in a XE "scene graph" scene graph relative to one another, based on their sizes and positions.
C) Most JavaFX layout panes use absolute positioning-if a layout-pane node is resized, it adjusts its childrens' sizes and positions accordingly, based on their properties.
D) All of the above statements are true.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following statements is false?
A) You add multiple RadioButtons to a ToggleGroup to ensure that many RadioButtons in a given group can be selected at a time.
B) You can specify each RadioButton's ToggleGroup in FXML.
C) You can create a ToggleGroup in Java, then use a RadioButton's XE "method of class RadioButton;RadioButton class (JavaFX):setToggleGroup method" setToggleGroup method to specify its ToggleGroup.
D) A XE "TitledPane class (JavaFX);Classes:TitledPane (JavaFX);JavaFX:TitledPane class " TitledPane displays a title at its top and is a collapsible panel containing a layout node, which in turn contains other nodes.
A) You add multiple RadioButtons to a ToggleGroup to ensure that many RadioButtons in a given group can be selected at a time.
B) You can specify each RadioButton's ToggleGroup in FXML.
C) You can create a ToggleGroup in Java, then use a RadioButton's XE "method of class RadioButton;RadioButton class (JavaFX):setToggleGroup method" setToggleGroup method to specify its ToggleGroup.
D) A XE "TitledPane class (JavaFX);Classes:TitledPane (JavaFX);JavaFX:TitledPane class " TitledPane displays a title at its top and is a collapsible panel containing a layout node, which in turn contains other nodes.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the statements a, b and c is true?
A) Pane is the base class for layout panes. This can be used to position nodes at fixed locations-known as XE "absolute positioning" absolute positioning.
B) XE "StackPane" StackPane Places nodes in a stack. Each new node is stacked atop the previous node. You might use this to place text on top of images, for example.
C) XE "TilePane class (JavaFX);Classes:TilePane (JavaFX);JavaFX:TilePane class " TilePane A horizontal or vertical grid of equally sized tiles. Nodes that are tiled horizontally wrap at the TilePane's width. Nodes that are tiled vertically wrap at the TilePane's height.
D) All of these statements are true.
A) Pane is the base class for layout panes. This can be used to position nodes at fixed locations-known as XE "absolute positioning" absolute positioning.
B) XE "StackPane" StackPane Places nodes in a stack. Each new node is stacked atop the previous node. You might use this to place text on top of images, for example.
C) XE "TilePane class (JavaFX);Classes:TilePane (JavaFX);JavaFX:TilePane class " TilePane A horizontal or vertical grid of equally sized tiles. Nodes that are tiled horizontally wrap at the TilePane's width. Nodes that are tiled vertically wrap at the TilePane's height.
D) All of these statements are true.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following statements is false?
A) By default a ListView supports multiple selection-many items at a time may be selected. ListViews also support single selection.
B) The type of selection is managed by the ListView's MultipleSelectionModel (a subclass of SelectionModel from package javafx.scene.control), which contains observable properties and various methods for manipulating the corresponding ListView's items.
C) To respond to selection changes, you register a listener for the MultipleSelectionModel's selectedItem property (lines 41-43).
D) ListView method getSelectionModel returns a MultipleSelectionModel object.
A) By default a ListView supports multiple selection-many items at a time may be selected. ListViews also support single selection.
B) The type of selection is managed by the ListView's MultipleSelectionModel (a subclass of SelectionModel from package javafx.scene.control), which contains observable properties and various methods for manipulating the corresponding ListView's items.
C) To respond to selection changes, you register a listener for the MultipleSelectionModel's selectedItem property (lines 41-43).
D) ListView method getSelectionModel returns a MultipleSelectionModel object.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
13
Though you can individually add items to a ListView, you can also bind a(n) ________ object to the ListView. If you make changes to this object, its observer will automatically be notified of those changes.
A) ListObserver
B) ObservableList
C) LIstViewObserver
D) None of the above
A) ListObserver
B) ObservableList
C) LIstViewObserver
D) None of the above
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the following describes an AnchorPane?
A) Enables you to set the position of child nodes relative to the pane's edges. Resizing the pane does not alter the layout of the nodes.
B) Includes five areas-top, bottom, left, center and right-where you can place nodes. The top and bottom regions fill its width and are vertically sized to their children's preferred heights. The left and right regions fill its height and are horizontally sized to their children's preferred widths. The center area occupies all of its remaining space. You might use the different areas for tool bars, navigation, a main content area, etc.
C) Lays out nodes consecutively-either horizontally or vertically. When the boundary for the pane is reached, the nodes wrap to a new line in a horizontal pane or a new column in a vertical pane.
D) Creates a flexible grid for laying out nodes in rows and columns.
A) Enables you to set the position of child nodes relative to the pane's edges. Resizing the pane does not alter the layout of the nodes.
B) Includes five areas-top, bottom, left, center and right-where you can place nodes. The top and bottom regions fill its width and are vertically sized to their children's preferred heights. The left and right regions fill its height and are horizontally sized to their children's preferred widths. The center area occupies all of its remaining space. You might use the different areas for tool bars, navigation, a main content area, etc.
C) Lays out nodes consecutively-either horizontally or vertically. When the boundary for the pane is reached, the nodes wrap to a new line in a horizontal pane or a new column in a vertical pane.
D) Creates a flexible grid for laying out nodes in rows and columns.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following is most closely associated with the statement, "Occurs for a given node when a drag operation that started in a different node continues over the given node."
A) onMouseDragEntered
B) onMouseDragExited
C) XE "onMouseDragged event (JavaFX);JavaFX:onMouseDragged event" onMouseDragged
D) onMouseDragOver
A) onMouseDragEntered
B) onMouseDragExited
C) XE "onMouseDragged event (JavaFX);JavaFX:onMouseDragged event" onMouseDragged
D) onMouseDragOver
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
16
JavaFX properties are ________-when a property's value changes, other objects can respond accordingly.
A) transparent
B) transferable
C) observable
D) disposable
A) transparent
B) transferable
C) observable
D) disposable
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following statements is false?
A) In the RGBA color system every color is represented by its red, green and blue color values, each ranging from 0 to 255, where 0 denotes no color and 255 full color.
B) The alpha value (A of RGBA)-which ranges from 0.0 to 1.0-represents a color's XE "opacity" opacity, with 0.0 being completely transparent and 1.0 completely opaque.
C) JavaFX makes extensive use of properties. A property is defined by creating set and get methods with specific naming conventions. public void setHour(int hour)
Public int getHour()
Define a read/write property named hour. Such methods manipulate a corresponding private instance variable that must have the same name as the property.
D) In general, the pair of methods that define a read/write property have the form: public void setPropertyName(Type propertyName)
Public Type getPropertyName()
A) In the RGBA color system every color is represented by its red, green and blue color values, each ranging from 0 to 255, where 0 denotes no color and 255 full color.
B) The alpha value (A of RGBA)-which ranges from 0.0 to 1.0-represents a color's XE "opacity" opacity, with 0.0 being completely transparent and 1.0 completely opaque.
C) JavaFX makes extensive use of properties. A property is defined by creating set and get methods with specific naming conventions. public void setHour(int hour)
Public int getHour()
Define a read/write property named hour. Such methods manipulate a corresponding private instance variable that must have the same name as the property.
D) In general, the pair of methods that define a read/write property have the form: public void setPropertyName(Type propertyName)
Public Type getPropertyName()
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
18
To perform an arbitrary task when a property's value changes, you can register a XE "property listener" property ________.
A) inquirer
B) follower
C) listener
D) spectator
A) inquirer
B) follower
C) listener
D) spectator
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following statements is false?
A) ToggleGroup method getSelectedToggle returns the Toggle that's currently selected. Class RadioButton is one of several controls (others are RadioButtonMenuItem and ToggleButton) that implements interface Toggle.
B) Each mouse event handler you define must provide one parameter of type MouseEvent. When the event occurs, this parameter contains information about the mouse event, such as its location, whether any mouse buttons were pressed, which node the user interacted with and more.
C) Each layout pane has a getChildren method that returns an ObservableList collection containing the layout's child nodes.
D) All JavaFX shapes inherit indirectly from class Shape in the javafx.scene package.
A) ToggleGroup method getSelectedToggle returns the Toggle that's currently selected. Class RadioButton is one of several controls (others are RadioButtonMenuItem and ToggleButton) that implements interface Toggle.
B) Each mouse event handler you define must provide one parameter of type MouseEvent. When the event occurs, this parameter contains information about the mouse event, such as its location, whether any mouse buttons were pressed, which node the user interacted with and more.
C) Each layout pane has a getChildren method that returns an ObservableList
D) All JavaFX shapes inherit indirectly from class Shape in the javafx.scene package.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
20
The ListCell<Type> subclass's ________ method creates the custom presentation. This method is called by the ListView's cell factory when a ListView cell is required-that is, when the ListView is first displayed and when ListView cells are about to scroll onto the screen.
A) update
B) updateItem
C) newPresentation
D) None of the above.
A) update
B) updateItem
C) newPresentation
D) None of the above.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck