Ch19 Test Bank Graphical User Interfaces - Big Java Early Objects 5e Complete Test Bank by Cay S. Horstmann. DOCX document preview.
Course Title: Big Java, Early Objects
Chapter Number: 19 Graphical User Interfaces
Question type: Multiple Choice
1) What is the default layout manager of JPanel?
a) FlowLayout
b) GridLayout
c) BoxLayout
d) GridBagLayout
Title: What is the default layout manager of JPanel?
Difficulty: Easy
Section Reference: 19.1 Layout Management
2) What is the default layout manager of the content pane of a JFrame?
a) FlowLayout
b) GridLayout
c) BoxLayout
d) BorderLayout
Title: What is the default layout manager of the content pane of a JFrame?
Difficulty: Easy
Section Reference: 19.1 Layout Management
3) Which class has constants called NORTH and SOUTH?
a) FlowLayout
b) BorderLayout
c) BoxLayout
d) GridLayout
Title: Which class has constants called NORTH and SOUTH?
Difficulty: Easy
Section Reference: 19.1 Layout Management
4) Which layout manager places objects left-to-right, and creates a new row only if when the current row cannot accommodate another object?
a) FlowLayout
b) BorderLayout
c) BoxLayout
d) GridLayout
Title: Which layout manager places objects left-to-right, and creates a new row only if when the current row cannot accommodate another object?
Difficulty: Easy
Section Reference: 19.1 Layout Management
5) Which layout manager places objects left-to-right, row by row into a fixed set of rows and columns?
a) FlowLayout
b) BorderLayout
c) BoxLayout
d) GridLayout
Title: Which layout manager places objects left-to-right, row by row into a fixed set of rows and columns?
Difficulty: Easy
Section Reference: 19.1 Layout Management
6) Which layout manager allows you to add components in different orders, with the result being the same GUI appearance?
I FlowLayout
II BorderLayout
III GridLayout
a) I
b) II
c) I and III
d) II and III
Title: Which layout manager allows you to add components in different orders?
Difficulty: Medium
Section Reference: 19.1 Layout Management
7) Which layout manager may change the location and size of existing components when new ones are added?
I FlowLayout
II BorderLayout
III GridLayout
a) I
b) II
c) I and III
d) II and III
Title: Which layout manager may change the location and size of existing components when new ones are added?
Difficulty: Medium
Section Reference: 19.1 Layout Management
8) Which layout manager uses a grid so that each component will always be placed into an area of the same size?
I GridBagLayout
II BorderLayout
III GridLayout
a) I
b) II
c) III
d) I and III
Title: Which layout manager uses a grid so components are placed into an area of the same size?
Difficulty: Medium
Section Reference: 19.1 Layout Management
9) Which layout manager uses a grid, but allows selected grid locations to span multiple rows or columns?
I GridBagLayout
II BorderLayout
III GridLayout
a) I
b) II
c) III
d) I and III
Title: Which layout manager allows grid locations to span multiple rows or columns?
Difficulty: Medium
Section Reference: 19.1 Layout Management
10) Which layout manager allows you to add components to it by invoking the container’s add method with the component as the only argument to add.
I FlowLayout
II BorderLayout
III GridLayout
a) I
b) II
c) III
d) I and III
Title: Which layout manager allows adding components with the component as the only argument?
Difficulty: Medium
Section Reference: 19.1 Layout Management
11) What is the easiest way to create complex-looking GUI layouts?
I use the GridBagLayout manager
II nest panels, each with its own layout manager
III use multiple layout managers in the same container
a) I
b) II
c) III
d) I and III
Title: What is the easiest way to create complex-looking GUI layouts?
Difficulty: Easy
Section Reference: 19.1 Layout Management
12) The JFrame has a content pane with a default BorderLayout manager. Which method allows changing it to a FlowLayout manager?
a) setLayout
b) setFlowLayout
c) assignLayout
d) changeLayout
Title: Which method allows changing to a FlowLayout manager?
Difficulty: Easy
Section Reference: 19.1 Layout Management
13) Which layout manager constructor call would be best-suited to create a telephone handset GUI which has three rows of three keys each with labels, 1,2,3,4,5,6,7,8,9, and a fourth row with labels *, 0, and #?
a) new GridLayout(3, 4)
b) new GridLayout(4, 3)
c) new FlowLayout(4, 3)
d) new BorderLayout(3, 4)
Title: Which layout manager constructor to use to create a telephone handset GUI ?
Difficulty: Easy
Section Reference: 19.1 Layout Management
14) Which layout manger would be best suited to create a simple navigation GUI with directional arrows for left, right, up, down and enter?
a) GridLayout
b) BorderLayout
c) FlowLayout
d) GridBagLayout
Title: Which layout manger would be best suited to create a simple navigation GUI with directional arrows for left, right, up, down and enter?
Difficulty: Easy
Section Reference: 19.1 Layout Management
15) To create a _____ layout, you supply the number of rows and columns in the constructor, then add the components, row by row, left to right.
a) border
b) grid
c) grid bag
d) boxed
Title: To create a ____ layout, supply the number of rows/columns and add the components, row by row, left to right.
Difficulty: Easy
Section Reference: 19.1 Layout Management
16) When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
a) border
b) grid
c) grid bag
d) flow
Title: When adding a component to a container with the _____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
Difficulty: Easy
Section Reference: 19.1 Layout Management
17) In Java, each container has its own ____________________, which determines how the components are laid out.
a) container
b) layout manager
c) Swing component
d) frame manager
Title: The ____ determines how the components are laid out.
Difficulty: Easy
Section Reference: 19.1 Layout Management
18) By default, a JPanel uses a _______ layout.
a) border
b) flow
c) grid
d) grid bag
Title: By default, a JPanel uses a ___ layout.
Difficulty: Medium
Section Reference: 19.1 Layout Management
19) If you want to have a tabular arrangement of components, in which columns have different sizes or one component spans multiple columns, a ____ would be appropriate.
a) grid bag layout
b) grid layout
c) flow layout
d) border layout
Title: What is the appropriate layout for a component with columns of different sizes?
Difficulty: Medium
Section Reference: 19.1 Layout Management
20) How do you add two buttons to the south area of a frame using the BorderLayout?
a) Add them to a panel, then add the panel to the SOUTH
b) Add one to the SOUTH, then add the second one to the SOUTH
c) Add one to the SOUTH, then add the second one to the CENTER
d) Add one to the CENTER, then add the second one to the SOUTH
Title: How do you add two buttons to the south area of a frame?
Difficulty: Medium
Section Reference: 19.1 Layout Management
21) Insert the missing code in the following segment. The code intends to get the newly selected item from the combo box.
JComboBox facenameCombo = new JComboBox();
String selectedString = __________________________;
a) (String) facenameCombo.getSelected();
b) (String) facenameCombo.getSelectedItem();
c) (String) selectedString.getSelected();
d) (String) selectedString.getSelectedItem();
Title: Insert missing code for getting combo box selected item
Difficulty: Medium
Section Reference: 19.3 Choices
22) A(n) ____ is used when you have a large set of choices.
a) combo box
b) radio button
c) check box
d) action event
Title: A ____ is used when you have a large set of choices.
Difficulty: Easy
Section Reference: 19.3 Choices
23) A ____ is a combination of a list and a text field.
a) radio button
b) combo box
c) check box
d) scroll bar
Title: A ____ is a combination of a list and a text field.
Difficulty: Easy
Section Reference: 19.3 Choices
24) When the user selects a menu item, the menu item sends a(n) ___________________.
a) ActionEvent
b) ChangeEvent
c) ItemEvent
d) MouseEvent
Title: When the user selects a menu item, the menu item sends a ___.
Difficulty: Easy
Section Reference: 19.4 Menus
25) The event that is generated by a slider when its value changes is of type _____.
a) ActionEvent
b) ChangeEvent
c) ItemEvent
d) MouseEvent
Title: The event that is generated by a slider when its value changes is of type _____.
Difficulty: Medium
Section Reference: 19.5 Exploring the Swing Documentation
26) Which GUI element allows text entry from the program user?
a) ButtonGroup
b) JComboBox
c) JSlider
d) JPanel
Title: Which GUI elements allows text entry from the user?
Difficulty: Easy
Section Reference: 19.3 Choices
27) ____________________ are round and have a black dot when selected.
a) Swing components
b) Selection buttons
c) Radio buttons
d) Check boxes
Section Reference: 19.3 Choices
Title: ___ are round and have a black dot when selected.
Difficulty: Easy
28) A ________ is a user-interface component with two states: checked and unchecked.
a) radio button
b) check box
c) menu item
d) submenu item
Section Reference: 19.3 Choices
Title: A ___ is a user-interface component with two states: checked and unchecked.
Difficulty: Easy
29) When using a combo box, the _______ displays the name of the current selection.
a) text field
b) text area
c) menu item
d) submenu item
Title: In a combo box, the ____ displays the name of the current selection.
Difficulty: Medium
Section Reference: 19.3 Choices
30) The statement that would add smallButton to the button group in the following code is _________.
JRadioButton smallButton = new JRadioButton("Small");
ButtonGroup group = new ButtonGroup();
a) group.add(new smallButton);
b) group.add(smallButton);
c) smallButton.add();
d) You cannot add smallButton to the button group.
Title: Write statement that would add smallButton to the button group
Difficulty: Easy
Section Reference: 19.3 Choices
31) Which of the following is not a visual component?
a) JRadioButton
b) JButton
c) ButtonGroup
d) JCheckBox
Title: Which of the following is not a visual component?
Difficulty: Medium
Section Reference: 19.3 Choices
32) Which of the following classes has a Boolean state that can be set or unset through the GUI?
a) JCheckBox
b) JButton
c) ButtonGroup
d) JMenuItem
Title: Which of the following classes has a Boolean state that can be set or unset through the GUI?
Difficulty: Easy
Section Reference: 19.3 Choices
33) Which of the following classes have a user-editable area?
a) JCheckBox
b) JComboBox
c) ButtonGroup
d) JRadioButton
Title: Which of the following classes have a user-editable area?
Difficulty: Medium
Section Reference: 19.3 Choices
34) Which of the following methods returns the object that was selected in the JComboBox?
a) getSelected
b) getItem
c) getChoice
d) getSelectedItem
Title: Which of the following methods returns the object that was selected in the JComboBox?
Difficulty: Easy
Section Reference: 19.3 Choices
35) What type does the method getSelectedItem in the JComboBox class return?
a) Object
b) String
c) JRadioButton
d) JLabel
Title: What type does the method getSelectedItem in the JComboBox class return?
Difficulty: Medium
Section Reference: 19.3 Choices
36) What type of object can be added into a JComboBox by the addItem method?
a) Object
b) String
c) JRadioButton
d) any non-primitive type
Title: What type of object can be added into a JComboBox by the addItem method?
Difficulty: Medium
Section Reference: 19.3 Choices
37) Which method can a program use to set the selected choice in a JComboBox?
a) select
b) setChoice
c) setSelectedItem
d) The selection can only be set through the GUI by the user.
Title: Which method can a program use to set the selected choice in a JComboBox?
Difficulty: Medium
Section Reference: 19.3 Choices
38) Which method can a program use to set the selected choice in a JRadioButton?
a) set
b) setChoice
c) setSelectedItem
d) setSelected
Title: Which method can a program use to set the selected choice in a JRadioButton?
Difficulty: Medium
Section Reference: 19.3 Choices
39) Which of the following GUI objects generate(s) action events?
I JComboBox
II JRadioButton
III JButton
a) I
b) I and II
c) I and III
d) I, II and III
Title: Which of the following GUI objects generate(s) action events?
Difficulty: Medium
Section Reference: 19.3 Choices
40) What is the container for top-level menu items?
a) menu bar
b) menu item
c) menu GUI
d) top level menus don’t use containers
Title: Which menu component can be added to a container?
Difficulty: Easy
Section Reference: 19.4 Menus
41) Which component can be added to a menu?
I JMenuBar
II JMenu
III JMenuItem
a) I
b) I and II
c) II and III
d) I, II and III
Title: Which component can be added to a menu?
Difficulty: Medium
Section Reference: 19.4 Menus
42) Which component can generate action events?
I JMenuBar
II JMenu
III JMenuItem
a) I
b) II
c) III
d) II and III
Title: Which component can generate action events?
Difficulty: Medium
Section Reference: 19.4 Menus
43) What can be determined about obj from the code below?
JMenuItem menuItem = new JMenuItem("Exit");
menuItem.addActionListener(obj);
a) The class of obj implements ActionListener
b) menuItem implements ActionListener
c) obj is of type MenuListener
d) obj is an object of an inner class
Title: What can be determined about obj from the code?
Difficulty: Medium
Section Reference: 19.4 Menus
44) Examine the code below. What type of class is MyMenuListener?
public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mini = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomething();
}
}
mini.addActionListener(new MyMenuListener());
return mi;
}
a) It is an anonymous class
b) It is an inner class
c) It is a JMenuItem subclass
d) It is a JMenu class
Title: Examine the code below. What type of class is MyMenuListener?
Difficulty: Medium
Section Reference: 19.4 Menus
45) If the method makeMenuItem is called four times, how many MyMenuListener objects will be created?
public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomething();
}
}
mi.addActionListener(new MyMenuListener());
return mi;
}
a) 1
b) 2
c) 3
d) 4
Title: If the method makeMenuItem is called 4 times, how many MyMenuListener objects will be created?
Difficulty: Medium
Section Reference: 19.4 Menus
46) If the makeMenuItem method is called four times, at most how many different actions can be performed by these four newly created MenuItem objects when the doSomethingElse method is called?
public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomethingElse(e);
}
}
mi.addActionListener(new MyMenuListener());
return mi;
}
a) 1
b) 2
c) 3
d) 4
Title: If the makeMenuItem method is called four times, how many different actions can be performed ... when the doSomethingElse method is called?
Difficulty: Hard
Section Reference: 19.4 Menus
47) The _______ interface toolkit has a large set of user-interface components.
a) GUI Builder
b) graphical user
c) Swing
d) JMenu
Title: The ___ interface toolkit has a large set of user-interface components.
Difficulty: Easy
Section Reference: 19.5 Exploring the Swing Documentation
48) What is the best way to start using Swing components?
a) Use a few classes with basic properties and methods, then explore API documentation
b) Learn all the classes in Swing and their inheritance hierarchies
c) Learn all the methods of the JComponent superclass before using any Swing components
d) Use a Swing component only after understanding all of its constructors
Section Reference: 19.5 Exploring the Swing Documentation
Title: What is the best way to start using Swing components?
Difficulty: Easy
49) What is the best way to discover the set of Swing components?
a) Randomly drag them into a visual appllication with a GUI builder
b) Write code to instantiate each component one at a time
c) Read the documentation for Swing
d) Run the SwingSet demo included in the JDK, Java Development Kit
Title: What is the best way to discover the set of Swing components?
Difficulty: Easy
Section Reference: 19.5 Exploring the Swing Documentation
50) For a new programmer using the Swing JSlider component for the first time, which of these is the least important thing to know?
a) a basic way to construct a JSlider
b) what type of events it generates
c) how to write the BoundedRangeModel constructor
d) its value when an event occurs
Title: For a new programmer using Swing for the first time, which of these is the least important to know?
Difficulty: Easy
Section Reference: 19.5 Exploring the Swing Documentation
51) What type of event does the JSlider class generate?
a) ChangeEvent
b) ActionEvent
c) ItemEvent
d) SliderEvent
Title: What type of event does the JSlider class generate?
Difficulty: Medium
Section Reference: 19.5 Exploring the Swing Documentation
52) What method is required by the ChangeListener interface?
a) changeOccured
b) actionPerformed
c) stateChanged
d) sliderMoved
Title: What method is required by the ChangeListener interface?
Difficulty: Medium
Section Reference: 19.5 Exploring the Swing Documentation
53) Which code will create a JSlider with a range from 0 to 100, with an initial value of 50?
I new JSlider()
II new JSlider(0, 100, 50)
III new JSlider(50, 0, 100)
a) I
b) II
c) III
d) I and II
Title: Which code will create a JSlider with a range from 0 to 100, with an initial value of 50?
Difficulty: Medium
Section Reference: 19.5 Exploring the Swing Documentation
54) The ChangeEvent class defines no methods. What makes it possible to call the getSource method on a ChangeEvent object?
a) The method is inherited from the Object class.
b) You have to code that method yourself.
c) The method is inherited from the EventObject class.
d) ChangeEvent implements the Event interface
Title: The ChangeEvent class defines no methods. What makes it possible that you can call the getSource method?
Difficulty: Hard
Section Reference: 19.5 Exploring the Swing Documentation
55) If one ChangeListener is listening for three different JSlider objects, how can we determine which of the three sliders caused the event when the code enters the stateChanged method?
a) It is not possible.
b) We can compare the sliders using the getSource method.
c) We can call the getValueIsAdjusting method.
d) We can compare the sliders using the getSliderSource method.
Title: If one ChangeListener is listening for three different JSlider objects, how can we determine which of the three sliders caused the event when the code enters the stateChanged method?
Difficulty: Hard
Section Reference: 19.5 Exploring the Swing Documentation
56) A complex GUI can be created with a set of nested panels. What should determine the components that go into a single panel?
a) the type of components
b) the size of the components
c) the adjacency of the components
d) the names of the components
Title: A complex GUI can be created with a set of nested panels. What should determine the components that go into a single panel?
Difficulty: Easy
Section Reference 1: 19.1 Layout Management
57) What is the best first step in picking the layout managers for a set of nested panels?
a) use a single panel with a GridBagLayout manager
b) construct a set of JPanel objects
c) make a sketch of the layout
d) use multiple panels with FlowLayout managers
Title: What is the best first step in picking the layout managers for a set of nested panels?
Difficulty: Easy
Section Reference 1: 19.1 Layout Management
58) If a JPanel with a BorderLayout manager contains a single component that was added to the CENTER, which parts of the JPanel does the component fill?
I North
II South
III Center
IV West
V East
a) I, II and III
b) II, IV an V
c) III, IV and V
d) I, II, III, IV and V
Title: If a JPanel with a BorderLayout manager contains a single component, which parts does it fill?
Difficulty: Medium
Section Reference 1: 19.1 Layout Management
59) Suppose a JPanel with a BorderLayout manager contains two components: component1, which was added to the NORTH, and component2, which was added to the SOUTH. Which parts of the JPanel will appear?
I North
II South
III Center
IV West
V East
a) I, II and III
b) II, IV an V
c) III, IV and V
d) I, II, III, IV an V
Title: Which parts of the JPanel with a BorderLayout manager appear?
Difficulty: Medium
Section Reference 1: 19.1 Layout Management
60) Suppose a JPanel with a BorderLayout manager contains two components: component1, which was added to the CENTER, and component2, which was added to the SOUTH. Which parts of the JPanel will appear?
I North
II South
III Center
IV West
V East
a) I, II
b) I, II, III
c) III, IV and V
d) II and III
Title: Which parts of the JPanel will appear?
Difficulty: Medium
Section Reference 1: 19.1 Layout Management
61) Suppose a JPanel with a BorderLayout manager contains two components: component1, which was added to the EAST, and component2, which was added to the WEST. Which parts of the JPanel appear?
I North
II South
III Center
IV West
V East
a) I, II
b) I, II, III
c) III, IV and V
d) IV an V
Title: Which parts of the JPanel appear?
Difficulty: Medium
Section Reference 1: 19.1 Layout Management
62) You can add a(n) _________ to a panel to make it visible.
a) component
b) JFrame
c) border
d) another panel
Title: You can add a ____ to a panel to make it visible.
Diff: Medium
Section Reference 1: 19.3 Choices
63) Which of the following adds a border to the following panel?
JPanel panel = new JPanel();
a) panel.addEtchedBorder();
b) panel.addBorder(new EtchedBorder());
c) panel.add(new EtchedBorder());
d) panel.setBorder(new EtchedBorder());
Title: Which statement adds a border to this panel?
Diff: Medium
Section Reference 1: 19.3 Choices
64) Given four JRadioButton objects in a ButtonGroup, how many radio buttons can be selected at the same time?
a) 1
b) 2
c) 4
d) 3
Title: Given four JRadioButton objects ..., how many can be selected at the same time?
Difficulty: Medium
Section Reference 1: 19.3 Choices
65) What is the most time-effective way to build a GUI quickly and concentrate on coding the logic of the program?
a) use the GridBagLayout manager
b) use a GUI builder, such as NetBeans
c) use nested panels
d) use menus
Title: What is the most time-effective way to build a GUI quickly and concentrate on coding the logic of the program?
Difficulty: Easy
Section Reference 1: 19.3 Choices
66) What features do GUI builders have to speed the development of the graphical user interface of the program?
I setting properties of dialog boxes
II automated event-handling code generation
III drag and drop of visual components
a) I
b) II
c) II and III
d) I, II and III
Title: What features do GUI builders have to speed the development of the graphical user interface of the program?
Difficulty: Easy
Section Reference 1: 19.3 Choices
67) When a menu item is selected, what type of event does it send?
a) ActionEvent
b) ChangeEvent
c) ItemEvent
d) SelectionEvent
Title: When a menu item is selected, what type of event does it send?
Diff: Easy
Section Reference 1: 19.4 Menus
68) What is wrong with the following code?
class ExitListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
System.exit(0);
}
}
ActionListener exitListener = new ExitListener();
JMenu exitMenu = new JMenu("Exit");
exitMenu.addActionListener(exitListener);
JMenuBar menuBar = new JMenuBar();
menuBar.add(exitMenu);
a) The ExitListener class is not public
b) You cannot attach a listener to a menu, only to a menu item
c) You cannot add a menu to the menu bar, only a menu item
d) You need to use a menu listener, not an action listener
Title: What is wrong with the following menu code?
Diff: Medium
Section Reference 1: 19.4 Menus
69) What is known for certain from this correct code excerpt?
ActionListener openListener = new FileOpenListener();
JMenuItem fileOpen = new JMenuItem("Open File");
fileOpen.addActionListener(openListener);
a) fileOpen will open a file dialog when clicked
b) The fileOpen menu item will be visible
c) The FileOpenListener class implements the ActionListener interface
d) The openListener object will only listen to the fileOpen object
Title: What is known for certain from this correct code excerpt?
Diff: Medium
Section Reference 1: 19.4 Menus
70) The code below will not compile successfully unless the argument to the makeMenuItem method is final. Why not?
public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomethingElse();
System.out.println(menuLabel);
}
}
mi.addActionListener(new MyMenuListener());
return mi;
}
a) JMenuItem labels must be final
b) This prevents the menuLabel argument from being modified
c) Because a local variable is being accessed from an inner classes
d) Because the String class is final
Title: The code below will not compile successfully unless the parameter to the makeMenuItem is final. Why not?
Difficulty: Hard
Section Reference 1: 19.4 Menus
71) When method makeMenuItem is called, how many objects are being created?
public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomethingElse();
System.out.println(menuLabel);
}
}
mi.addActionListener(new MyMenuListener());
return mi;
}
a) 1
b) 2
c) 3
d) 4
Title: When method makeMenuItem is called, how many objects are being created?
Difficulty: Hard
Section Reference 1: 19.4 Menus
72) How do the lifetimes of the three objects menuLabel, mi, and the anonymous object new MyMenuListener()compare?
public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomethingElse();
System.out.println(menuLabel);
}
}
mi.addActionListener(new MyMenuListener());
return mi;
}
a) all have the same lifetimes
b) menuLabel and new MyMenuListener()are the same and both longer than mi
c) mi and new MyMenuListener()are the same and both longer than menuLabel
d) from shortest to longest: menuLabel, new MyMenuListener(), mi
Title: How do the lifetimes of the three objects menuLabel, mi, and the anonymous object new MyMenuListener()compare?
Difficulty: Hard
Section Reference 1: 19.4 Menus
73) Which of the following statements is correct?
a) new JSlider() creates a horizontal slider with the range 0 to 200 and an initial value of 100.
b) new JSlider() creates a horizontal slider with the range 0 to 10 and an initial value of 5.
c) new JSlider() creates a horizontal slider with the range 0 to 100 and an initial value of 50.
d) new JSlider() creates a horizontal slider with the range 0 to 150 and an initial value of 100.
Title: Which JSlider constructor statement is correct?
Difficulty: Medium
Section Reference 1: 19.5 Exploring the Swing Documentation
74) The documentation for the JSlider class lists ____ inherited methods.
a) less than 5
b) about 25
c) about 250
d) over 2500
Title: The documentation for the JSlider class lists ____ inherited methods.
Diff: Medium
Section Reference 1: 19.5 Exploring the Swing Documentation
75) Based on the statement below, which of the following adds a title to the border?
JPanel panel = new JPanel();
a) panel.setBorder(new TitledBorder());
b) panel.setBorder(new TitledBorder(new EtchedBorder(), "Size"));
c) panel.setBorder(new TitledBorder(new EtchedBorder()));
d) panel.setTitle("Size");
Title: Which of the following adds a title to the border?
Diff: Medium
Section Reference 1: 19.3 Choices
76) Which elements of creating a graphical user interface are made easier by a GUI builder?
I creating event handlers
II configuring component properties
III adding components
a) II
b) I and II
c) I and III
d) I, II and III
Title: Which elements of creating a graphical user interface are made easier by a GUI builder?
Difficulty: Easy
Section Reference 1: 19.3 Choices