Deck 6: Graphical User Interfaces
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
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/40
Play
Full screen (f)
Deck 6: Graphical User Interfaces
1
A panel is displayed as a separate window, but a frame can only be displayed as part of another container.
False
Explanation: A frame is displayed as a separate window, but a panel can only be displayed as part of another container.
Explanation: A frame is displayed as a separate window, but a panel can only be displayed as part of another container.
2
Which of the following layout managers organize the components from left to right, starting new rows as necessary?
A) Border Layout
B) Box Layout
C) Card Layout
D) Flow Layout
E) Grid Layout
A) Border Layout
B) Box Layout
C) Card Layout
D) Flow Layout
E) Grid Layout
D
Explanation: The flow layout organizes components from left to right, starting new rows as necessary. A border layout organizes components into five areas: north, south, east, west, and center. The box layout organizes components into a single row or column. The card layout organizes components into one area such that only one is visible at any time. A grid layout organizes components into a grid of rows and columns.
Explanation: The flow layout organizes components from left to right, starting new rows as necessary. A border layout organizes components into five areas: north, south, east, west, and center. The box layout organizes components into a single row or column. The card layout organizes components into one area such that only one is visible at any time. A grid layout organizes components into a grid of rows and columns.
3
Which of the following components can be toggled on or off using the mouse, indicating that a particular boolean condition is set or unset?
A) check box
B) radio button
C) slider
D) dialog box
E) none of the above
A) check box
B) radio button
C) slider
D) dialog box
E) none of the above
A
Explanation: A check box can be toggled on or off using the mouse indicating that particular boolean condition is set or unset. A radio button represents a set of mutually exclusive options. A slider represents a range of values and a dialog box is a graphical window that pops up and allows the user to interact with the program.
Explanation: A check box can be toggled on or off using the mouse indicating that particular boolean condition is set or unset. A radio button represents a set of mutually exclusive options. A slider represents a range of values and a dialog box is a graphical window that pops up and allows the user to interact with the program.
4
Which of the following classes play a role in altering a visual aspect of a component?
A) ColorChooser
B) ToolTip
C) BorderFactory
D) ColorCreator
E) none of the above
A) ColorChooser
B) ToolTip
C) BorderFactory
D) ColorCreator
E) none of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following event descriptions best describes the mouse entered event?
A) The mouse button is pressed down
B) The mouse button is pressed down and released without moving the mouse in between
C) The mouse pointer is moved onto a component
D) The mouse button is released
E) The mouse is moved while the mouse button is pressed down
A) The mouse button is pressed down
B) The mouse button is pressed down and released without moving the mouse in between
C) The mouse pointer is moved onto a component
D) The mouse button is released
E) The mouse is moved while the mouse button is pressed down
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following is a fundamental idea of good GUI design?
A) Know the user
B) Prevent user errors
C) Optimize user abilities.
D) Be consistent.
E) all of the above
A) Know the user
B) Prevent user errors
C) Optimize user abilities.
D) Be consistent.
E) all of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
A container is goverened by a(n) __________________, which determines exactly how the components added to the panel will be displayed.
A) event
B) content pane
C) JFrame object
D) JPanel object
E) layout manager
A) event
B) content pane
C) JFrame object
D) JPanel object
E) layout manager
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following best describes a timer component?
A) it starts when a GUI component is first initialized, and ends when it is destroyed
B) it generates action events at regular intervals
C) every object has a timer, and it is implicitly activated in the constructor of the object
D) it determines the amount of time it takes to execute a method
E) a timer cannot be considered a GUI component
A) it starts when a GUI component is first initialized, and ends when it is destroyed
B) it generates action events at regular intervals
C) every object has a timer, and it is implicitly activated in the constructor of the object
D) it determines the amount of time it takes to execute a method
E) a timer cannot be considered a GUI component
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
A(n) _______________________ is a graphical window that pops up on top of any currently active window so that the user can interact with it.
A) component
B) dialog box
C) event
D) listener
E) none of the above
A) component
B) dialog box
C) event
D) listener
E) none of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
A(n) ____________________ is an object that waits for an event to occur and responds in some way when it does.
A) GUI
B) component
C) listener
D) frame
E) panel
A) GUI
B) component
C) listener
D) frame
E) panel
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following represents a dialog box that allows the user to select a file from a disk or other storage medium?
A) color chooser
B) disk chooser
C) tool tip chooser
D) file chooser
E) none of the above
A) color chooser
B) disk chooser
C) tool tip chooser
D) file chooser
E) none of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
A(n) ___________________ is an object that defines a screen element used to display information or allow the user to interact with a program in a certain way.
A) GUI
B) component
C) event
D) listener
E) AWT
A) GUI
B) component
C) event
D) listener
E) AWT
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following components allows the user to select one of several options from a "drop down" menu?
A) check boxes
B) radio buttons
C) sliders
D) combo boxes
E) none of the above
A) check boxes
B) radio buttons
C) sliders
D) combo boxes
E) none of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
Check boxes operate as a group, providing a set of mutually exclusive options.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
A dialog box allows the user to select one of several options from a "drop down" menu.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following components allows the user to enter typed input from the keyboard.
A) check boxes
B) radio buttons
C) sliders
D) combo boxes
E) none of the above
A) check boxes
B) radio buttons
C) sliders
D) combo boxes
E) none of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
A _____________________ container is one that is managed by the underlying operating system on which the program is run, whereas a __________________ container is managed by the Java program itself.
A) heavyweight, lightweight
B) lightweight, heavyweight
C) content pane, applet
D) applet content pane
E) none of the above
A) heavyweight, lightweight
B) lightweight, heavyweight
C) content pane, applet
D) applet content pane
E) none of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
GUI is an acronym for _______________________.
A) graphical UML interface
B) graphical UML implementation
C) graphical user implementation
D) graphical user interface
E) none of the above
A) graphical UML interface
B) graphical UML implementation
C) graphical user implementation
D) graphical user interface
E) none of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
The grid layout organizes components into a grid of rows and columns, and also allows components to span more than one cell.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
Layout managers determine how components are visually presented.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
Write a short class that represents a panel with a single slider that has values from 0 to 250, with large tick marks in increments of 50 and small tick marks in increments of 10.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
State the four fundamental ideas of good GUI design.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
Write a short class that represents a panel with a single radio button that has the option "Yes" and the option "No." By default, the Yes button should be checked.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
Any Swing component can be assigned a tool tip.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
Explain the difference between check boxes and radio buttons.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
The keyHit event is called when a key is pressed.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
What is the difference between a mnemonic and a tool tip?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
Give an example of a common use of a dialog box.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
A color chooser is a dialog box.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
Describe the difference between a heavyweight container and a lightweight container. Give an example of each.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
A mnemonic is a short line of text that will appear when the cursor is rested momentarily on top of the component.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
Explain the difference between a combo box and a dialog box.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
Write a keyPressed method that behaves as follows. If the user presses the up arrow, the method should output "You pressed up" using the System.out.println method. If the user presses the down arrow, the method should output "You pressed down" using the System.out.println method.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
The ability of the user should be ignored when designing GUIs. In other words, GUIs should be designed with the most unskilled user in mind.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
Should a component ever be disabled? Why or why not?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
Describe the areas of a border layout.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
Write a short snippet of code that creates a JPanel object called p1, and creates a border around it containing the title "this is a JPanel."
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
Explain the difference between a Grid Layout and a GridBag Layout.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
Suppose we have created a class called MyGUI, which represents a GUI. Write a program that creates a JFrame object, adds a MyGUI object to the frame and makes it visible.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
Write a program that produces a simple GUI that has a single button labeled "Push Me."
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck