Deck 12: Java-Fx: Advanced Controls

Full screen (f)
exit full mode
Question
In a JavaFX CSS style definition, if a selector name starts with a period, that selector corresponds to a

A) value entered by the user
B) specific JavaFX node
C) named color
D) specific variable in the application
Use Space or
up arrow
down arrow
to flip the card.
Question
To apply specific styles to all of the nodes in a scene, use the __________ selector.

A) .stage
B) .top
C) .root
D) .all
Question
When the user selects an item in a ListView, a change event occurs.
Question
Styles specified with the .root selector take precedence over styles applied to any other node.
Question
In a JavaFX applicaton, a CSS type selector corresponds to a specific JavaFX node.
Question
The type of control normally used when you want the user to only be allowed to select one option from several possible options is the

A) Button
B) RadioButton
C) CheckBox
D) Any of these
Question
On a Web page, the __________ specifies what information to display and the __________ specifies how that information should be displayed.

A) HTML, JavaFX
B) code, CSS
C) HTML, CSS
D) CSS, HTML
Question
To create a mutually exclusive relationship between RadioMenuItem controls, you must group them in a ToggleGroup object.
Question
If you have two RadioButtons (dogRadio and catRadio), how should you code them to create a mutually exclusive relationship?

A) ToggleGroup radioGroup = new ToggleGroup();
DogRadio.setToggleGroup(radioGroup);
CatRadio.setToggleGroup(radioGroup):
B) ToggleGroup radioGroup = new radioGroup();
DogRadio.setToggle(radioGroup);
CatRadio.setToggle(radioGroup):
C) dogRadio.setToggleGroup();
CatRadio.setToggleGroup():
D) ToggleGroup dogRadio = new ToggleGroup();
ToggleGroup catRadio = new ToggleGroup();
Question
In JavaFX all CSS properties begin with -fx-.
Question
A ComboBox differs only from a ListView in that a ComboBox must have a minimum of three items.
Question
In a JavaFX applicaton, you must recompile the application each time you make a change to the stylesheet.
Question
A TextArea is a multiline TextField that can accept or display several lines of text.
Question
Which of the following will create a CheckBox that displays pizza and shows up as selected?

A) CheckBox checkOne.setSelected(true) = "pizza";
B) CheckBox checkOne = new CheckBox("pizza");
CheckOne.setSelected(true);
C) CheckBox checkOne = new CheckBox("pizza");
CheckBox.setSelected(false);
D) CheckBox checkOne("pizza") = setSelected(true);
Question
How would a stylesheet named javafxstyles.css be applied to a JavaFX application, assuming that scene is the variable that refers to a Scene object?

A) scene.getStyles().add("javafxstyles.css");
B) scene.getStylesheets().add(javafxstyles.css);
C) scene.getStylesheets().add("javafxstyles.css");
D) scene.addStylesheets().get("javafxstyles.css");
Question
CSS uses the RGB color system to define colors and colors can be specified using six hexadecimal numbers preceded by the # symbol.
Question
Radio buttons are normally used when you want the user to be able to select one or more options from a group of several possible options.
Question
In the hexadecimal color value #CCAA99, the CC refers to which color component?

A) red
B) blue
C) green
D) yellow
Question
The control that displays a list of items and allows the user to select an item from the list is the __________ control.

A) List
B) SelectionList
C) ListView
D) ArrayList
Question
Which of the following creates a custom style class that will allow a Button control to appear with a blue background and yellow text?

A) .button-color {
-fx- background-color: blue;
-fx- text-fill: yellow;
}
B) .button-color {
-fx- bgcolor: blue;
-fx- textfill: yellow;
}
C) .blue-button {
Background-color: blue;
Text-fill: yellow;
}
D) .blue-button {
-fx- background: blue;
-fx- text: yellow;
}
Question
Which CSS type selector corresponds with the TextField JavaFX class?

A) text-box
B) text-field
C) text-area
D) text
Question
Select all that apply. Which of the following ComboBox methods require a boolean argument?

A) getValue
B) setVisibleRowCount
C) setEditable
D) setValue
Question
Which of the following is a CSS named color?

A) maroon
B) crimson
C) lavender
D) All of these
Question
Select all that apply. Which of the following classes inherit from the Region class?

A) Label
B) RadioButton
C) CheckBox
D) ListBox
Question
What happens when the following code is executed? ComboBox myComboBox = new ComboBox<>();
MyComboBox.getItems().addAll(5, 10, 15, 20);

A) A ComboBox displaying the numbers 5, 10, 15, and 20 will be created.
B) The values 5, 10, 15, and 20 will be added to a ComboBox named myComboBox.
C) The values 5, 10, 15, and 20 will be converted to strings and added a new ComboBox named myComboBox.
D) A compiler error will occur.
Question
Select all that apply. The SetStyle method is used to apply style rules directly to a JavaFX node. This method

A) allows you to pass only one style rule at a time, as a string argument
B) allows you to pass multiple style rules as string arguments
C) is considered a better way to add styles than using a stylesheet
D) removes any styles that were previously applied to that node
Question
Which of the following statements will set a ListView control, puppyListView, to be 300 pixels high and 200 pixels wide?

A) puppyListView.setSize(200, 300);
B) puppyListView.setSize(300, 200);
C) puppyListView.setPrefSize(200, 300);
D) puppyListView.setPrefSize(300, 200);
Question
Given the following styles, what size will the text of myLabel be? .root { -fx- font-size: 12pt; }
)label { -fx- font-size: 18pt; }

A) 12 pts
B) 18 pts
C) 15 pts
D) This will cause an error because there are duplicate font-size styles.
Question
In CSS, selector names that begin with a period are called __________ selectors.

A) class
B) node
C) type
D) object
Question
To replace a ListView control's existing items with a new list of items, use the __________ method.

A) getItems.addAll()
B) getItems().setAll()
C) getItems().addAll()
D) getItems.setAll()
Question
Which of the following statements creates an empty TextArea?

A) TextArea textArea = new TextArea();
B) TextArea textArea = new TextArea(" ");
C) TextArea = new textArea();
D) TextArea textArea = new TextArea.textArea("");
Question
Select all that apply. Which of the following are possible selection nodes available to the ListView control?

A) multiple selection mode
B) single selection mode
C) multiple interval selection mode
D) single interval selection mode
Question
Adding RadioButton controls to a __________ object creates a mutually exclusive relationship between them.

A) MutualGroup
B) RadioGroup
C) ToggleGroup
D) ExcludeGroup
Question
Select all that apply. Which of the following methods can be used with both ArrayLists and ObservableLists?

A) the get method
B) the size method
C) the remove method
D) the set method
Question
To build a menu system you must

A) create a MenuBar object
B) create the Menu objects and register an event handler for each menu item object
C) Add the MenuBar object to the scene graph
D) All of these are necessary steps.
Question
Which of the following statements will allow a user to type input into a field of a ComboBox named myComboBox?

A) ComboBox.setEditable;
B) myComboBox.setEditable(true);
C) ComboBox.setEditable(myComboBox);
D) myComboBox = ComboBox.setEditable(true);
Question
What does the following code do, assuming there is a variable that references a Scene object? myScene.getStylesheets().add("sceneStyles.css");

A) It adds a stylesheet named sceneStyles to Scene.
B) It adds a stylesheet named myScene to Scene.
C) The getStylesheets method returns an object containing the scene's collection of stylesheets and that object's add method adds sceneStyles.css to the collection.
D) The getStylesheets method gets sceneStyles.css and adds it to the to the myScene object.
Question
The __________ control uses a drop-down list as its display.

A) DropList
B) ItemList
C) TextList
D) ListView
Question
Which of the following statements creates a Sider with a range of 1 to 20 with a starting value of 1?

A) Slider slider = new Slider(0, 20, 1);
B) Slider slider = new slider(0.0, 20.0, 1.0);
C) Slider slider = new Slider(1.0, 20.0, 1.0);
D) Slider slider = new Slider(1.0, 20);
Question
The __________ class is used to create a menu bar.

A) MenuBar
B) Menu
C) MenuItem
D) Bar
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 12: Java-Fx: Advanced Controls
1
In a JavaFX CSS style definition, if a selector name starts with a period, that selector corresponds to a

A) value entered by the user
B) specific JavaFX node
C) named color
D) specific variable in the application
B
2
To apply specific styles to all of the nodes in a scene, use the __________ selector.

A) .stage
B) .top
C) .root
D) .all
C
3
When the user selects an item in a ListView, a change event occurs.
True
4
Styles specified with the .root selector take precedence over styles applied to any other node.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
In a JavaFX applicaton, a CSS type selector corresponds to a specific JavaFX node.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
The type of control normally used when you want the user to only be allowed to select one option from several possible options is the

A) Button
B) RadioButton
C) CheckBox
D) Any of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
On a Web page, the __________ specifies what information to display and the __________ specifies how that information should be displayed.

A) HTML, JavaFX
B) code, CSS
C) HTML, CSS
D) CSS, HTML
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
To create a mutually exclusive relationship between RadioMenuItem controls, you must group them in a ToggleGroup object.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
If you have two RadioButtons (dogRadio and catRadio), how should you code them to create a mutually exclusive relationship?

A) ToggleGroup radioGroup = new ToggleGroup();
DogRadio.setToggleGroup(radioGroup);
CatRadio.setToggleGroup(radioGroup):
B) ToggleGroup radioGroup = new radioGroup();
DogRadio.setToggle(radioGroup);
CatRadio.setToggle(radioGroup):
C) dogRadio.setToggleGroup();
CatRadio.setToggleGroup():
D) ToggleGroup dogRadio = new ToggleGroup();
ToggleGroup catRadio = new ToggleGroup();
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
In JavaFX all CSS properties begin with -fx-.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
A ComboBox differs only from a ListView in that a ComboBox must have a minimum of three items.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
In a JavaFX applicaton, you must recompile the application each time you make a change to the stylesheet.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
A TextArea is a multiline TextField that can accept or display several lines of text.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the following will create a CheckBox that displays pizza and shows up as selected?

A) CheckBox checkOne.setSelected(true) = "pizza";
B) CheckBox checkOne = new CheckBox("pizza");
CheckOne.setSelected(true);
C) CheckBox checkOne = new CheckBox("pizza");
CheckBox.setSelected(false);
D) CheckBox checkOne("pizza") = setSelected(true);
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
How would a stylesheet named javafxstyles.css be applied to a JavaFX application, assuming that scene is the variable that refers to a Scene object?

A) scene.getStyles().add("javafxstyles.css");
B) scene.getStylesheets().add(javafxstyles.css);
C) scene.getStylesheets().add("javafxstyles.css");
D) scene.addStylesheets().get("javafxstyles.css");
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
CSS uses the RGB color system to define colors and colors can be specified using six hexadecimal numbers preceded by the # symbol.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
Radio buttons are normally used when you want the user to be able to select one or more options from a group of several possible options.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
In the hexadecimal color value #CCAA99, the CC refers to which color component?

A) red
B) blue
C) green
D) yellow
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
The control that displays a list of items and allows the user to select an item from the list is the __________ control.

A) List
B) SelectionList
C) ListView
D) ArrayList
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
Which of the following creates a custom style class that will allow a Button control to appear with a blue background and yellow text?

A) .button-color {
-fx- background-color: blue;
-fx- text-fill: yellow;
}
B) .button-color {
-fx- bgcolor: blue;
-fx- textfill: yellow;
}
C) .blue-button {
Background-color: blue;
Text-fill: yellow;
}
D) .blue-button {
-fx- background: blue;
-fx- text: yellow;
}
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
Which CSS type selector corresponds with the TextField JavaFX class?

A) text-box
B) text-field
C) text-area
D) text
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
Select all that apply. Which of the following ComboBox methods require a boolean argument?

A) getValue
B) setVisibleRowCount
C) setEditable
D) setValue
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following is a CSS named color?

A) maroon
B) crimson
C) lavender
D) All of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
Select all that apply. Which of the following classes inherit from the Region class?

A) Label
B) RadioButton
C) CheckBox
D) ListBox
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
What happens when the following code is executed? ComboBox myComboBox = new ComboBox<>();
MyComboBox.getItems().addAll(5, 10, 15, 20);

A) A ComboBox displaying the numbers 5, 10, 15, and 20 will be created.
B) The values 5, 10, 15, and 20 will be added to a ComboBox named myComboBox.
C) The values 5, 10, 15, and 20 will be converted to strings and added a new ComboBox named myComboBox.
D) A compiler error will occur.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
Select all that apply. The SetStyle method is used to apply style rules directly to a JavaFX node. This method

A) allows you to pass only one style rule at a time, as a string argument
B) allows you to pass multiple style rules as string arguments
C) is considered a better way to add styles than using a stylesheet
D) removes any styles that were previously applied to that node
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following statements will set a ListView control, puppyListView, to be 300 pixels high and 200 pixels wide?

A) puppyListView.setSize(200, 300);
B) puppyListView.setSize(300, 200);
C) puppyListView.setPrefSize(200, 300);
D) puppyListView.setPrefSize(300, 200);
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
Given the following styles, what size will the text of myLabel be? .root { -fx- font-size: 12pt; }
)label { -fx- font-size: 18pt; }

A) 12 pts
B) 18 pts
C) 15 pts
D) This will cause an error because there are duplicate font-size styles.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
In CSS, selector names that begin with a period are called __________ selectors.

A) class
B) node
C) type
D) object
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
To replace a ListView control's existing items with a new list of items, use the __________ method.

A) getItems.addAll()
B) getItems().setAll()
C) getItems().addAll()
D) getItems.setAll()
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following statements creates an empty TextArea?

A) TextArea textArea = new TextArea();
B) TextArea textArea = new TextArea(" ");
C) TextArea = new textArea();
D) TextArea textArea = new TextArea.textArea("");
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
Select all that apply. Which of the following are possible selection nodes available to the ListView control?

A) multiple selection mode
B) single selection mode
C) multiple interval selection mode
D) single interval selection mode
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
Adding RadioButton controls to a __________ object creates a mutually exclusive relationship between them.

A) MutualGroup
B) RadioGroup
C) ToggleGroup
D) ExcludeGroup
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
Select all that apply. Which of the following methods can be used with both ArrayLists and ObservableLists?

A) the get method
B) the size method
C) the remove method
D) the set method
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
To build a menu system you must

A) create a MenuBar object
B) create the Menu objects and register an event handler for each menu item object
C) Add the MenuBar object to the scene graph
D) All of these are necessary steps.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following statements will allow a user to type input into a field of a ComboBox named myComboBox?

A) ComboBox.setEditable;
B) myComboBox.setEditable(true);
C) ComboBox.setEditable(myComboBox);
D) myComboBox = ComboBox.setEditable(true);
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
What does the following code do, assuming there is a variable that references a Scene object? myScene.getStylesheets().add("sceneStyles.css");

A) It adds a stylesheet named sceneStyles to Scene.
B) It adds a stylesheet named myScene to Scene.
C) The getStylesheets method returns an object containing the scene's collection of stylesheets and that object's add method adds sceneStyles.css to the collection.
D) The getStylesheets method gets sceneStyles.css and adds it to the to the myScene object.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
The __________ control uses a drop-down list as its display.

A) DropList
B) ItemList
C) TextList
D) ListView
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following statements creates a Sider with a range of 1 to 20 with a starting value of 1?

A) Slider slider = new Slider(0, 20, 1);
B) Slider slider = new slider(0.0, 20.0, 1.0);
C) Slider slider = new Slider(1.0, 20.0, 1.0);
D) Slider slider = new Slider(1.0, 20);
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
The __________ class is used to create a menu bar.

A) MenuBar
B) Menu
C) MenuItem
D) Bar
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 40 flashcards in this deck.