Deck 13: Java-Fx: Advanced Controls

Full screen (f)
exit full mode
Question
A TextArea is a multiline TextField that can accept or display several lines of text.
Use Space or
up arrow
down arrow
to flip the card.
Question
CSS uses the RGB color system to define colors and colors can be specified using six hexadecimal numbers preceded by the # symbol.
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
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
Question
In the hexadecimal color value #CCAA99, the CC refers to the __________ color component?

A) red
B) blue
C) green
D) yellow
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
In a JavaFX application, you must recompile the application each time you make a change to the stylesheet.
Question
In a JavaFX application, a CSS type selector corresponds to a specific JavaFX node.
Question
Styles specified with the .root selector take precedence over styles applied to any other node.
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
To create a mutually exclusive relationship between RadioMenuItem controls, you must group them in a ToggleGroup object.
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
A ComboBox differs only from a ListView in that a ComboBox must have a minimum of three items.
Question
When the user selects an item in a ListView, a change event occurs.
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
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 apply specific styles to all of the nodes in a scene, use the __________ selector.

A) .stage
B) .top
C) .root
D) .all
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
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
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
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
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 ComboBox methods require a boolean argument?

A) getValue
B) setVisibleRowCount
C) setEditable
D) setValue
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
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 creates a Slider 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
Adding RadioButton controls to a __________ object creates a mutually exclusive relationship between them.

A) MutualGroup
B) RadioGroup
C) ToggleGroup
D) ExcludeGroup
Question
The __________ class is used to create a menu bar.

A) MenuBar
B) Menu
C) MenuItem
D) Bar
Question
The __________ control uses a drop-down list as its display.

A) DropList
B) ItemList
C) TextList
D) ListView
Question
In CSS, selector names that begin with a period are called __________ selectors.

A) class
B) node
C) type
D) object
Question
Given the following styles, what size will the text of the label 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
Select all that apply. Which of the following classes inherit from the Region class?

A) Label
B) RadioButton
C) CheckBox
D) ListBox
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
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 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
Which CSS type selector corresponds with the TextField JavaFX class?

A) text-box
B) text-field
C) text-area
D) text
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
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
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
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 13: Java-Fx: Advanced Controls
1
A TextArea is a multiline TextField that can accept or display several lines of text.
True
2
CSS uses the RGB color system to define colors and colors can be specified using six hexadecimal numbers preceded by the # symbol.
True
3
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;
}
A
4
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
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
In the hexadecimal color value #CCAA99, the CC refers to the __________ 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
6
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
7
In a JavaFX application, 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
8
In a JavaFX application, 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
9
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
10
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
11
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
12
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
13
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
14
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
15
When the user selects an item in a ListView, a change event occurs.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
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
17
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
18
To apply specific styles to all of the nodes in a scene, use the __________ selector.

A) .stage
B) .top
C) .root
D) .all
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
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
21
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
22
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
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 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
25
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
26
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
27
Which of the following statements creates a Slider 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
28
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
29
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
30
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
31
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
32
Given the following styles, what size will the text of the label 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
33
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
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
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
36
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
37
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
38
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
39
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
40
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
locked card icon
Unlock Deck
Unlock for access to all 40 flashcards in this deck.