Deck 30: Swing Gui Components
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 30: Swing Gui Components
1
Mnemonics can be used with all subclasses of which class?
A) AbstractButton.
B) JMenu.
C) JMenuItem
D) JComponent.
A) AbstractButton.
B) JMenu.
C) JMenuItem
D) JComponent.
A
2
Which of the following is not a class UIManager method?
A) LookAndFeelInfo().
B) getInstalledLookAndFeels().
C) setLookAndFeel().
D) getLookAndFeel().
A) LookAndFeelInfo().
B) getInstalledLookAndFeels().
C) setLookAndFeel().
D) getLookAndFeel().
A
3
Menus are attached to windows by calling method ________.
A) addMenuBar.
B) setJMenuBar.
C) setMenu.
D) addJMenuBar.
A) addMenuBar.
B) setJMenuBar.
C) setMenu.
D) addJMenuBar.
B
4
The first argument to method showMessageDialog specifies ________.
A) the title.
B) the message.
C) the icon.
D) the parent window.
A) the title.
B) the message.
C) the icon.
D) the parent window.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
5
Arrow keys can manipulate a JSlider object. Which of the following statements does not correctly describe how the arrow keys are used?
A) The left-arrow and right arrow keys decrease or increase (respectively) the thumb of the JSlider by 1.
B) The down-arrow and up-arrow keys decrease or increase (respectively) the thumb of the JSlider by 1.
C) The PgDn and PgUp keys decrease or increase (respectively) by block increments of one-tenth of the range of values.
D) The Home key and End key move the thumb to the maximum or minimum (respectively) value of the JSlider.
A) The left-arrow and right arrow keys decrease or increase (respectively) the thumb of the JSlider by 1.
B) The down-arrow and up-arrow keys decrease or increase (respectively) the thumb of the JSlider by 1.
C) The PgDn and PgUp keys decrease or increase (respectively) by block increments of one-tenth of the range of values.
D) The Home key and End key move the thumb to the maximum or minimum (respectively) value of the JSlider.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
6
Which statement below is false?
A) Each JPopupMenu should be associated with its own component.
B) Local variables must be declared static to be used in an anonymous inner class declaration.
C) The JPopupMenu show method specifies the origin component, and the coordinates at which the JPopupMenu should display on the component.
D) None of the above.
A) Each JPopupMenu should be associated with its own component.
B) Local variables must be declared static to be used in an anonymous inner class declaration.
C) The JPopupMenu show method specifies the origin component, and the coordinates at which the JPopupMenu should display on the component.
D) None of the above.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following is false?
A) JFrame is a lightweight component.
B) JFrame is a subclass of Frame (which is a subclass of Window).
C) JFrames have a title bar and a border.
D) A JFrame window will look like all other windows displayed on that platform.
A) JFrame is a lightweight component.
B) JFrame is a subclass of Frame (which is a subclass of Window).
C) JFrames have a title bar and a border.
D) A JFrame window will look like all other windows displayed on that platform.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
8
JSliders generate what type of event?
A) ActionEvents.
B) ChangeEvents.
C) WindowEvents.
D) MouseEvents.
A) ActionEvents.
B) ChangeEvents.
C) WindowEvents.
D) MouseEvents.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
9
By default, the tabs on a JTabbedPane appear at the:
A) top.
B) bottom.
C) left.
D) right.
A) top.
B) bottom.
C) left.
D) right.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the choices below do not complete the following sentence correctly? A _________ is a ___________.
A) JMenuBar, JComponent.
B) JMenuItem, AbstractButton.
C) JMenu, JMenuItem.
D) JRadioButtonMenuItem, JMenu.
A) JMenuBar, JComponent.
B) JMenuItem, AbstractButton.
C) JMenu, JMenuItem.
D) JRadioButtonMenuItem, JMenu.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following is not a look-and-feel?
A) Windows.
B) Motif.
C) Metal.
D) None of the above.
A) Windows.
B) Motif.
C) Metal.
D) None of the above.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
12
A JSlider cannot display which of the following:
A) Major tick marks.
B) Minor tick marks labels.
C) Minor tick marks.
D) Snap-to ticks.
A) Major tick marks.
B) Minor tick marks labels.
C) Minor tick marks.
D) Snap-to ticks.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
13
Which method returns true if the popup trigger event occurred?
A) isTrigger.
B) isPopup.
C) isPopupTrigger.
D) isTriggerEvent.
A) isTrigger.
B) isPopup.
C) isPopupTrigger.
D) isTriggerEvent.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
14
A JTabbedPane
A) arranges GUI components into layers such that only one layer is visible at a time.
B) allows users to access a layer of GUI components via a tab.
C) extends JComponent.
D) All of the above.
A) arranges GUI components into layers such that only one layer is visible at a time.
B) allows users to access a layer of GUI components via a tab.
C) extends JComponent.
D) All of the above.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following is not one of the seven methods for handling window events?
A) windowClosing.
B) windowClosed.
C) windowOpening.
D) windowOpened.
A) windowClosing.
B) windowClosed.
C) windowOpening.
D) windowOpened.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is not a Java AWT portability issue?
A) GUI components that have different looks on different platforms may use different amounts of space.
B) GUI components may have different default functionality.
C) Different platforms may have different representations of integers.
D) All of the above.
A) GUI components that have different looks on different platforms may use different amounts of space.
B) GUI components may have different default functionality.
C) Different platforms may have different representations of integers.
D) All of the above.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
17
Which constructor below creates a JInternalFrame that is resizable, closable, maximizable, and minimizable?
A) JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, true);
B) JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, false, true);
C) JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, false);
D) JInternalFrame frame = new JInternalFrame("Internal Frame", false, false, true, true);
A) JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, true);
B) JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, false, true);
C) JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, false);
D) JInternalFrame frame = new JInternalFrame("Internal Frame", false, false, true, true);
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
18
In a multiple-document interface (MDI), a JDesktopPane is the parent window and what class is the child window?
A) JChild.
B) JInternalFrame.
C) JChildWindow.
D) JFrame.
A) JChild.
B) JInternalFrame.
C) JChildWindow.
D) JFrame.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
19
A JFrame supports three operations when the user closes the window. Which of the choices below is not one of the three:
A) DISPOSE_ON_CLOSE.
B) DO_NOTHING_ON_CLOSE.
C) LOWER_ON_CLOSE.
D) HIDE_ON_CLOSE.
A) DISPOSE_ON_CLOSE.
B) DO_NOTHING_ON_CLOSE.
C) LOWER_ON_CLOSE.
D) HIDE_ON_CLOSE.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
20
What happens if setSize is not called on a window?
A) The window is displayed at its preferred size.
B) It is a syntax error.
C) The window is not displayed.
D) Only the title bar appears.
A) The window is displayed at its preferred size.
B) It is a syntax error.
C) The window is not displayed.
D) Only the title bar appears.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
21
To create a fixed space between all components using BoxLayout, use the method ________.
A) createVerticalStrut()
B) createHorizontalStrut()
C) createGlue()
D) createRigidArea()
A) createVerticalStrut()
B) createHorizontalStrut()
C) createGlue()
D) createRigidArea()
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
22
What GridBagConstraints constants can be used in place of gridx and gridy?
A) RELATIVE and REMAINDER.
B) CENTER and BOTH.
C) NORTH and SOUTH.
D) FILL and NONE.
A) RELATIVE and REMAINDER.
B) CENTER and BOTH.
C) NORTH and SOUTH.
D) FILL and NONE.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
23
To evenly distribute fixed-size components in a row using BoxLayout, use the method ________.
A) createVerticalStrut()
B) createHorizontalStrut()
C) createVerticalGlue()
D) createHorizontalGlue()
A) createVerticalStrut()
B) createHorizontalStrut()
C) createVerticalGlue()
D) createHorizontalGlue()
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following GridBagConstraints specifies the number of columns a component will occupy?
A) gridwidth.
B) gridheight.
C) weightx.
D) weighty.
A) gridwidth.
B) gridheight.
C) weightx.
D) weighty.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
25
What is the default value for the GridBagConstraint fill?
A) NONE.
B) BOTH.
C) CENTER.
D) HORIZONTAL.
A) NONE.
B) BOTH.
C) CENTER.
D) HORIZONTAL.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
26
The GridBagContraints constant RELATIVE means that ________.
A) the component is the last component.
B) the component is the next to last component.
C) the component should be placed relative to the previous component.
D) Both b and c
A) the component is the last component.
B) the component is the next to last component.
C) the component should be placed relative to the previous component.
D) Both b and c
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck