Deck 14: Gui Components: Part 1
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
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/77
Play
Full screen (f)
Deck 14: Gui Components: Part 1
1
Which component contains menus?
A)Menu button.
B)Title bar.
C)Menu bar.
D)Combo box.
A)Menu button.
B)Title bar.
C)Menu bar.
D)Combo box.
C
2
Which of the following is the method used to display a dialog box to gather input?
A)showMessageDialog.
B)getInput.
C)inputDialog.
D)showInputDialog.
A)showMessageDialog.
B)getInput.
C)inputDialog.
D)showInputDialog.
D
3
Which JFrame constant indicates that the program should terminate when the window is closed by the user?
A)TERMINATE_ON_CLOSE.
B)IMMEDIATELY_CLOSE.
C)EXIT_ON_CLOSE.
D)All of the above.
A)TERMINATE_ON_CLOSE.
B)IMMEDIATELY_CLOSE.
C)EXIT_ON_CLOSE.
D)All of the above.
C
4
Which of the following does not generate GUI events?
A)Typing in a text field.
B)Selecting an item from a menu.
C)Viewing the text in a label.
D)Moving the mouse.
A)Typing in a text field.
B)Selecting an item from a menu.
C)Viewing the text in a label.
D)Moving the mouse.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
5
The text "Hello there,my friend." is an example of what type of capitalization?
A)sentence-style capitalization.
B)book-title capitalization.
C)Neither of the above.
D)Both of the above.
A)sentence-style capitalization.
B)book-title capitalization.
C)Neither of the above.
D)Both of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
6
Provides the basic attributes and behaviors of a window-a title bar at the top of the window,and buttons to minimize,maximize and close the window.
A)JLabel.
B)JFrame.
C)JSwing.
D)JWindowControl.
A)JLabel.
B)JFrame.
C)JSwing.
D)JWindowControl.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
7
Which pair of words does not complete the sentence below correctly? A ________ is a ________.
A)Container,Component.
B)Container,JPanel.
C)JComponent,Container.
D)Component,Object.
A)Container,Component.
B)Container,JPanel.
C)JComponent,Container.
D)Component,Object.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
8
Together,the appearance and the way in which the user interacts with the application are known as that application's .
A)abstract window toolkit.
B)look-and-feel.
C)swing factor.
D)All of the above.
A)abstract window toolkit.
B)look-and-feel.
C)swing factor.
D)All of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following statements for a JTextField is false?
A)Can be used to display uneditable text.
B)Can be used to display editable text.
C)Enables users to enter data from the keyboard.
D)Displays a list of fields.
A)Can be used to display uneditable text.
B)Can be used to display editable text.
C)Enables users to enter data from the keyboard.
D)Displays a list of fields.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
10
Which methods retrieve and set the image that's displayed in a JLabel?
A)getIcon,setIcon.
B)getResource,setResource.
C)getText,setText.
D)getImageIcon,setImageIcon.
A)getIcon,setIcon.
B)getResource,setResource.
C)getText,setText.
D)getImageIcon,setImageIcon.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
11
Which expression returns the location of a file as a URL?
A)getURL( "file.txt" ).
B)getResource( "file.txt" ).
C)findResource( "file.txt" ).
D)getClass( "file.txt" ).
A)getURL( "file.txt" ).
B)getResource( "file.txt" ).
C)findResource( "file.txt" ).
D)getClass( "file.txt" ).
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
12
Some common lightweight component features supported by JComponent include:
A)support for user-interface localization.
B)shortcut keys.
C)tool tips.
D)All of the above.
A)support for user-interface localization.
B)shortcut keys.
C)tool tips.
D)All of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following expressions creates a JLabel that displays the text "Here is what I look like!" The JLabel should display Icon object face,and the JLabel's contents should be left aligned.
A)new JLabel( "Here is what I look like!",face,SwingConstants.LEFT )
B)new JLabel( "Here is what I look like!",face,SwingJustification.LEFT )
C)new JLabel( "Here is what I look like!",SwingConstants.LEFT,face )
D)new JLabel( "Here is what I look like!",SwingJustification.LEFT,face )
A)new JLabel( "Here is what I look like!",face,SwingConstants.LEFT )
B)new JLabel( "Here is what I look like!",face,SwingJustification.LEFT )
C)new JLabel( "Here is what I look like!",SwingConstants.LEFT,face )
D)new JLabel( "Here is what I look like!",SwingJustification.LEFT,face )
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the following statements about heavyweight components is false?
A)AWT components are not heavyweight components.
B)Several Swing components are heavyweight components.
C)The look-and-feel may vary across platforms.
D)The functionality may vary across platforms.
A)AWT components are not heavyweight components.
B)Several Swing components are heavyweight components.
C)The look-and-feel may vary across platforms.
D)The functionality may vary across platforms.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
15
The JOptionPane constant used to display an icon prompting the user for input is:
A)JOptionPane.ERROR_MESSAGE.
B)JOptionPane.INFORMATION_MESSAGE.
C)JOptionPane.QUESTION_MESSAGE.
D)JOptionPane.WARNING_MESSAGE.
A)JOptionPane.ERROR_MESSAGE.
B)JOptionPane.INFORMATION_MESSAGE.
C)JOptionPane.QUESTION_MESSAGE.
D)JOptionPane.WARNING_MESSAGE.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
16
Which method sets the text that's displayed when the user hovers over a JLabel?
A)setHover.
B)setHoverText.
C)setToolTip.
D)setToolTipText.
A)setHover.
B)setHoverText.
C)setToolTip.
D)setToolTipText.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following is not a GUI component (control or widget)?
A)String.
B)Button.
C)Menu.
D)Combo box.
A)String.
B)Button.
C)Menu.
D)Combo box.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
18
Which of the following statements about Swing GUI components is false?
A)Swing components are less portable but more flexible than the original Java GUI components from package java.awt.
B)Most Swing components are written completely in Java.
C)Swing components allow the user to specify a uniform look-and-feel across all platforms.
D)Swing components allow the user to change the look-and-feel while the program is running.
A)Swing components are less portable but more flexible than the original Java GUI components from package java.awt.
B)Most Swing components are written completely in Java.
C)Swing components allow the user to specify a uniform look-and-feel across all platforms.
D)Swing components allow the user to change the look-and-feel while the program is running.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following statements about a JLabel is false?
A)Applications rarely change a label's contents after creating it.
B)A JLabel can display text and an image.
C)A JLabel can display text and a button.
D)A JLabel is a subclass of JComponent.
A)Applications rarely change a label's contents after creating it.
B)A JLabel can display text and an image.
C)A JLabel can display text and a button.
D)A JLabel is a subclass of JComponent.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
20
A JLabel can be attached to a JFrame using method:
A)attach.
B)contain.
C)append.
D)add.
A)attach.
B)contain.
C)append.
D)add.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
21
The logical relationship between radio buttons is maintained by objects of what class?
A)MutualExclusionGroup.
B)RadioButtonGroup.
C)Group.
D)ButtonGroup.
A)MutualExclusionGroup.
B)RadioButtonGroup.
C)Group.
D)ButtonGroup.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following is false?
A)A JPasswordField shows that characters are being entered,but hides the actual character with an echo character.
B)Class JTextField extends JTextComponent;Class JPasswordField extends JTextField.
C)Both JTextFields and JPasswordFields are single-line areas in which the user can enter text via the keyboard.
D)JPasswordFields generate events;JTextFields do not.
A)A JPasswordField shows that characters are being entered,but hides the actual character with an echo character.
B)Class JTextField extends JTextComponent;Class JPasswordField extends JTextField.
C)Both JTextFields and JPasswordFields are single-line areas in which the user can enter text via the keyboard.
D)JPasswordFields generate events;JTextFields do not.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
23
JPasswordField contains method to obtain the data entered.
A)getInput.
B)getPassword.
C)getText.
D)getEcho.
A)getInput.
B)getPassword.
C)getText.
D)getEcho.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
24
When the user presses Enter in a JPasswordField,the GUI component generates an ,which is processed by an object that implements the interface .
A)ActionEvent,ActionListener.
B)ActionEvent,ActionEventListener.
C)TextEvent,TextListener.
D)TextEvent,TextEventListener.
A)ActionEvent,ActionListener.
B)ActionEvent,ActionEventListener.
C)TextEvent,TextListener.
D)TextEvent,TextEventListener.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
25
Forgetting to register an event-handler object for a particular GUI component's event type causes .
A)events of that type to be ignored.
B)all of the GUI component's events to be ignored.
C)a compilation error.
D)None of the above.
A)events of that type to be ignored.
B)all of the GUI component's events to be ignored.
C)a compilation error.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
26
How many event-listener interfaces correspond to each event type?
A)one.
B)two.
C)one or more.
D)zero.
A)one.
B)two.
C)one or more.
D)zero.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
27
The GUI event with which the user interacts is the .
A)event effector.
B)event container.
C)event raiser.
D)event source.
A)event effector.
B)event container.
C)event raiser.
D)event source.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following is not necessary to use the event delegation model?
A)An event listener must be registered.
B)An event handler must be implemented.
C)The appropriate interface must be implemented.
D)The appropriate interface must be registered.
A)An event listener must be registered.
B)An event handler must be implemented.
C)The appropriate interface must be implemented.
D)The appropriate interface must be registered.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
29
Which of the following completes the sentence below correctly? A(n) is a(n) .
A)InputEvent,MouseEvent.
B)ActionEvent,AdjustmentEvent.
C)FocusEvent,WindowEvent.
D)ContainerEvent,ComponentEvent.
A)InputEvent,MouseEvent.
B)ActionEvent,AdjustmentEvent.
C)FocusEvent,WindowEvent.
D)ContainerEvent,ComponentEvent.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
30
The method setRolloverIcon is used to:
A)Handle a key event.
B)Change the button text.
C)Change the button icon.
D)All of the above.
A)Handle a key event.
B)Change the button text.
C)Change the button icon.
D)All of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
31
Which method determines if a JCheckBox is selected?
A)isSelected.
B)getSelected.
C)selected.
D)None of the above.
A)isSelected.
B)getSelected.
C)selected.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
32
Every JComponent has an instance variable called that enables the object to maintain references to all its registered listeners.
A)registeredListenerList.
B)listenerList.
C)registeredList.
D)eventListenerList.
A)registeredListenerList.
B)listenerList.
C)registeredList.
D)eventListenerList.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following most completely describes the steps for setting up event handling for a GUI component?
A)Create a class that represents the event handler,attach the JFrame to a JWindow object and register the event handler.
B)Implement an appropriate event-listener interface and register the event handler.
C)Create a class that represents the event handler and implement an appropriate event-listener interface.
D)Create a class that represents the event handler,implement an appropriate event-listener interface and register the event handler.
A)Create a class that represents the event handler,attach the JFrame to a JWindow object and register the event handler.
B)Implement an appropriate event-listener interface and register the event handler.
C)Create a class that represents the event handler and implement an appropriate event-listener interface.
D)Create a class that represents the event handler,implement an appropriate event-listener interface and register the event handler.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following statements makes the text in a JTextField uneditable?
A)textField.setEditable( true );
B)textField.setEditable( false );
C)textField.setUneditable( true );
D)textField.setUneditable( false );
A)textField.setEditable( true );
B)textField.setEditable( false );
C)textField.setUneditable( true );
D)textField.setUneditable( false );
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
35
A JRadioButton is different from a JCheckBox in that .
A)a JRadioButton is a subclass of JToggleButton,JCheckBox is not.
B)normally several JRadioButtons are grouped together and are mutually exclusive.
C)a JRadioButton is a type of button,JCheckBox is not.
D)a JRadioButton is a state button,JCheckBox is not.
A)a JRadioButton is a subclass of JToggleButton,JCheckBox is not.
B)normally several JRadioButtons are grouped together and are mutually exclusive.
C)a JRadioButton is a type of button,JCheckBox is not.
D)a JRadioButton is a state button,JCheckBox is not.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following choices completes the sentence correctly? A(n) is a(n) .
A)JToggleButton,JCheckBox.
B)JToggleButton,JRadioButton.
C)JButton,JToggleButton.
D)JButton,AbstractButton.
A)JToggleButton,JCheckBox.
B)JToggleButton,JRadioButton.
C)JButton,JToggleButton.
D)JButton,AbstractButton.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
37
When the user clicks a JCheckBox,a(n) occurs.
A)CheckedEvent.
B)ButtonEvent.
C)ItemEvent.
D)ActionEvent.
A)CheckedEvent.
B)ButtonEvent.
C)ItemEvent.
D)ActionEvent.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following is stateless?
A)JButton.
B)JToggleButton.
C)JRadioButton.
D)JCheckBox.
A)JButton.
B)JToggleButton.
C)JRadioButton.
D)JCheckBox.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following is not a type of button?
A)command buttons.
B)toggle buttons.
C)check boxes.
D)All of the above are types of buttons.
A)command buttons.
B)toggle buttons.
C)check boxes.
D)All of the above are types of buttons.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
40
Which of the following answers does not complete the sentence correctly? An anonymous inner class .
A)is frequently used for GUI event handling.
B)is non-static.
C)does not need a handle to its outer class to access its methods and variables.
D)cannot be declared private.
A)is frequently used for GUI event handling.
B)is non-static.
C)does not need a handle to its outer class to access its methods and variables.
D)cannot be declared private.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
41
Method paintComponent is called when:
A)a lightweight Swing component is created.
B)a lightweight Swing component is displayed.
C)a lightweight Swing component is clicked.
D)an application exits.
A)a lightweight Swing component is created.
B)a lightweight Swing component is displayed.
C)a lightweight Swing component is clicked.
D)an application exits.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
42
Which of the following is a MouseMotionListener method?
A)mousePressed.
B)mouseExited.
C)mouseDragged.
D)mouseClicked.
A)mousePressed.
B)mouseExited.
C)mouseDragged.
D)mouseClicked.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
43
Method getSelectedValues of class JList returns:
A)an array of ints representing the indices of the selected items.
B)an array of doubles representing the indices of the selected items.
C)an array of Strings representing the selected items.
D)an array of Objects representing the selected items.
A)an array of ints representing the indices of the selected items.
B)an array of doubles representing the indices of the selected items.
C)an array of Strings representing the selected items.
D)an array of Objects representing the selected items.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
44
A user of a one-button mouse can simulate pushing the middle button on a three-button mouse by holding the while clicking the left mouse button.
A)Alt key.
B)Meta key.
C)Ctrl key.
D)Shift key.
A)Alt key.
B)Meta key.
C)Ctrl key.
D)Shift key.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
45
The setMaximumRowCount method is used for:
A)Button.
B)JComboBox.
C)JRadioButton.
D)JToggleButton.
A)Button.
B)JComboBox.
C)JRadioButton.
D)JToggleButton.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
46
A MouseHandler object implements which two interfaces?
A)MouseListener and MouseActionListener.
B)MouseListener and MouseMotionListener.
C)MouseListener and MouseEventListener.
D)MouseListener only.
A)MouseListener and MouseActionListener.
B)MouseListener and MouseMotionListener.
C)MouseListener and MouseEventListener.
D)MouseListener only.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
47
Method getSelectedIndex of class JComboBox returns:
A)the index of the selected item in the JComboBox.
B)the selected item in the JComboBox,as a String.
C)the index of the previously selected item.
D)None of the above.
A)the index of the selected item in the JComboBox.
B)the selected item in the JComboBox,as a String.
C)the index of the previously selected item.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
48
The BorderLayout layout manager:
A)divides an area into five regions: NORTH,SOUTH,EAST,WEST and CENTER.
B)divides an area into five regions: UP,DOWN,LEFT,RIGHT and MIDDLE.
C)orders components vertically.
D)order components horizontally.
A)divides an area into five regions: NORTH,SOUTH,EAST,WEST and CENTER.
B)divides an area into five regions: UP,DOWN,LEFT,RIGHT and MIDDLE.
C)orders components vertically.
D)order components horizontally.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
49
In what cases are adapter classes useful?
A)When an adapter GUI control is clicked.
B)When every method in the event-listener interface is to use the same functionality.
C)When it is not desirable to declare every method in the event-listener interface.
D)None of the above.
A)When an adapter GUI control is clicked.
B)When every method in the event-listener interface is to use the same functionality.
C)When it is not desirable to declare every method in the event-listener interface.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
50
When the arrow on a JComboBox is clicked:
A)an ItemEvent occurs.
B)a scrollbar always appears.
C)an ActionEvent occurs.
D)The JComboBox expands to a list.
A)an ItemEvent occurs.
B)a scrollbar always appears.
C)an ActionEvent occurs.
D)The JComboBox expands to a list.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
51
Which of the following statements about adapters is false?
A)An adapter class implements an interface.
B)An adapter class provides a default (empty)implementation of every method in the interface.
C)Programmers override selected adapter methods.
D)A ComponentListener is a ComponentAdaptor.
A)An adapter class implements an interface.
B)An adapter class provides a default (empty)implementation of every method in the interface.
C)Programmers override selected adapter methods.
D)A ComponentListener is a ComponentAdaptor.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
52
Selecting a JList item generates:
A)an ActionEvent.
B)a ListItemEvent.
C)a ListSelectionEvent.
D)a ListSelectionItemEvent.
A)an ActionEvent.
B)a ListItemEvent.
C)a ListSelectionEvent.
D)a ListSelectionItemEvent.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
53
A JScrollPane is provided automatically for which of the following?
A)JToggleButton.
B)JRadioButton.
C)JList.
D)None of the above.
A)JToggleButton.
B)JRadioButton.
C)JList.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
54
When a component is ,paintComponent clears the component's background before the component is displayed.
A)transparent.
B)opaque.
C)oblique.
D)concave.
A)transparent.
B)opaque.
C)oblique.
D)concave.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
55
Which of the following statements about anonymous inner classes is false?
A)They are declared without a name.
B)They typically appear inside a method declaration.
C)They are declared with the anonymous keyword.
D)They can access their top-level class's members.
A)They are declared without a name.
B)They typically appear inside a method declaration.
C)They are declared with the anonymous keyword.
D)They can access their top-level class's members.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
56
Which MouseEvent method can be used to determine if the Alt key is pressed?
A)isAltPressed.
B)isAltDown.
C)getClickCount.
D)AltPressed.
A)isAltPressed.
B)isAltDown.
C)getClickCount.
D)AltPressed.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
57
Adding a ButtonGroup object to a container:
A)is necessary for the functionality of the ButtonGroup to work properly.
B)causes all the JRadioButtons in the group to have their event handlers registered.
C)results in a compilation error.
D)None of the above.
A)is necessary for the functionality of the ButtonGroup to work properly.
B)causes all the JRadioButtons in the group to have their event handlers registered.
C)results in a compilation error.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
58
Which of the following objects cannot trap mouse events?
A)JTextField.
B)ButtonGroup.
C)JButton.
D)JComponent.
A)JTextField.
B)ButtonGroup.
C)JButton.
D)JComponent.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
59
Consider the list below: January
February
March
April
May
June
July
August
September
October
November
December
What type of JList selection mode would allow the user to select March,June and July in one step?
A)SINGLE_SELECTION.
B)SINGLE_INTERVAL_SELECTION.
C)MULTIPLE_INTERVAL_SELECTION.
D)All of the above.
February
March
April
May
June
July
August
September
October
November
December
What type of JList selection mode would allow the user to select March,June and July in one step?
A)SINGLE_SELECTION.
B)SINGLE_INTERVAL_SELECTION.
C)MULTIPLE_INTERVAL_SELECTION.
D)All of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
60
Class Point represents:
A)a filled oval.
B)an x-y coordinate.
C)an object used to draw.
D)a period in a sentence.
A)a filled oval.
B)an x-y coordinate.
C)an object used to draw.
D)a period in a sentence.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
61
By default JScrollPane:
A)always displays scrollbars.
B)never displays scrollbars.
C)only displays scrollbars if they are needed.
D)None of the above.
A)always displays scrollbars.
B)never displays scrollbars.
C)only displays scrollbars if they are needed.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
62
The Shift key is a(n) key.
A)modifier.
B)action.
C)output.
D)None of the above.
A)modifier.
B)action.
C)output.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
63
FlowLayout method changes the alignment for the FlowLayout.
A)setLayout.
B)modifyAlignment.
C)setAlignment.
D)setAlign.
A)setLayout.
B)modifyAlignment.
C)setAlignment.
D)setAlign.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
64
Class JTextArea's getSelectedText method:
A)returns the text in the JTextArea.
B)returns the selected text in the JTextArea.
C)displays only the selected text in the JTextArea.
D)sets the selected text in the JTextArea.
A)returns the text in the JTextArea.
B)returns the selected text in the JTextArea.
C)displays only the selected text in the JTextArea.
D)sets the selected text in the JTextArea.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
65
Which region is used by default when a Component is added to a BorderLayout?
A)NORTH.
B)CENTER.
C)WEST.
D)LEFT.
A)NORTH.
B)CENTER.
C)WEST.
D)LEFT.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
66
Each container can have:
A)only one layout manager.
B)one or more layout managers.
C)zero or more layout managers.
D)only one or two layout managers.
A)only one layout manager.
B)one or more layout managers.
C)zero or more layout managers.
D)only one or two layout managers.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
67
All layout managers implement the interface:
A)LayoutInterface.
B)InterfaceLayoutManager.
C)LayoutManagerInterface.
D)LayoutManager.
A)LayoutInterface.
B)InterfaceLayoutManager.
C)LayoutManagerInterface.
D)LayoutManager.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
68
Which methods can be used to change the scrollbar policies?
A)setHoizontalPolicy,setVerticalPolicy.
B)setHorizontal,setVertical.
C)setHPolicy,setVPolicy.
D)setHorizontalScrollBarPolicy,setVerticalScrollBarPolicy.
A)setHoizontalPolicy,setVerticalPolicy.
B)setHorizontal,setVertical.
C)setHPolicy,setVPolicy.
D)setHorizontalScrollBarPolicy,setVerticalScrollBarPolicy.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
69
BorderLayout implements interface:
A)ActionListener.
B)FlowLayout.
C)Layout.
D)LayoutManager2.
A)ActionListener.
B)FlowLayout.
C)Layout.
D)LayoutManager2.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
70
FlowLayout is:
A)an abstract class.
B)a way of organizing components vertically.
C)the simplest layout manager.
D)left-aligned by default.
A)an abstract class.
B)a way of organizing components vertically.
C)the simplest layout manager.
D)left-aligned by default.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
71
Using layout managers:
A)provides the greatest level of control over a GUI's appearance.
B)can be faster than creating a GUI with absolute positioning.
C)allows the programmer to specify the exact location of each GUI component with respect to the upper-left corner of the Container.
D)allows the programmer to specify the exact location of each GUI component with respect to the lower-left corner of the Container.
A)provides the greatest level of control over a GUI's appearance.
B)can be faster than creating a GUI with absolute positioning.
C)allows the programmer to specify the exact location of each GUI component with respect to the upper-left corner of the Container.
D)allows the programmer to specify the exact location of each GUI component with respect to the lower-left corner of the Container.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
72
Which of the following is not a KeyListener method?
A)keyPressed.
B)keyReleased.
C)keyClicked.
D)keyTyped.
A)keyPressed.
B)keyReleased.
C)keyClicked.
D)keyTyped.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
73
When components are added to a container with a GridLayout,the component:
A)fills the next spot in the row,continuing in the first position of the next row if the current row is full.
B)fills the next spot in the column,continuing in the first position of the next column if the column is full.
C)fills in row x,column y if x and y are two integers passed to the Container method add.
D)fills in a random empty position in the grid.
A)fills the next spot in the row,continuing in the first position of the next row if the current row is full.
B)fills the next spot in the column,continuing in the first position of the next column if the column is full.
C)fills in row x,column y if x and y are two integers passed to the Container method add.
D)fills in a random empty position in the grid.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
74
A JTextArea:
A)provides a bounding box used for the layout of JTextFields.
B)wraps lines by default.
C)provides an area for manipulating multiple lines of text.
D)provides scrollbars for JTextFields.
A)provides a bounding box used for the layout of JTextFields.
B)wraps lines by default.
C)provides an area for manipulating multiple lines of text.
D)provides scrollbars for JTextFields.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
75
Which of the following statements about JPanels is false?
A)A JPanel is a JComponent.
B)A JPanel is a Container.
C)A JPanel does not have a content pane.
D)A JPanel has a fixed size.
A)A JPanel is a JComponent.
B)A JPanel is a Container.
C)A JPanel does not have a content pane.
D)A JPanel has a fixed size.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
76
Which layout manager is the default for JFrame?
A)FlowLayout.
B)BorderLayout.
C)GridLayout.
D)None of the above.
A)FlowLayout.
B)BorderLayout.
C)GridLayout.
D)None of the above.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
77
The class GridLayout constructs to hold components.
A)a horizontal grid with one row.
B)a vertical grid with one column.
C)a grid with multiple rows and columns.
D)a square grid with the same number of rows as columns.
A)a horizontal grid with one row.
B)a vertical grid with one column.
C)a grid with multiple rows and columns.
D)a square grid with the same number of rows as columns.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck