Content Frame
Note for screen reader users: There is text between the form elements on this page. To be sure that you do not miss any text, use item by item navigation methods, rather than tabbing from form element to form element.
Skip Breadcrumb Navigation
Home  arrow Student Resources  arrow Chapter Quizzes  arrow Chapter 17

Chapter 17

Swing I

This activity contains 15 questions.

Question 1.
A panel:
  1. Allows you to group objects
  2. Displays with a user-specified border type and color
  3. Can contain up to 10 (sub-) panels
  4. Can have its own layout manager


Open Hint for Question 1 in a new window.
 
End of Question 1


Question 2.

The setActionCommand method:
  1. Changes the label on its associated button or menu item
  2. Changes the value of the private instance variable associated with its button or menu item
  3. Can be used to differentiate between buttons (or menu items) with the same label
  4. Is an ordinary mutator method associated with the corresponding button or menu item
  5. Assumes that the programmer will use getActionCommand to retrieve the stored information

Open Hint for Question 2 in a new window.
 
End of Question 2


Question 3.
The differences between a text field and a text area are:
  1. A text field can contain but a single line of text
  2. A text area can contain but a single line of text
  3. A text field can wrap text, if desired
  4. A text area can wrap text, if desired


Open Hint for Question 3 in a new window.
 
End of Question 3


Question 4.

The Dimension Class:
  1. Specifies a size: width x height
  2. Specifies a size: height x width
  3. Specifies a size: either width x height or height x width forms may be used
  4. Provides for the creation of Dimension objects. These objects are only used within button and menu creation/specification methods

Open Hint for Question 4 in a new window.
 
End of Question 4


Question 5.

What are the advantages of having a separate ActionListener for each button or menu item?
  1. No need for multiway if-else statements or switch statements
  2. No need for testing to see which component generated the event
  3. May be implemented as private inner classes, thus improving encapsulation
  4. Direct access to all relevant information in both directions (to/from inner classes) if private inner classes are used

Open Hint for Question 5 in a new window.
 
End of Question 5


Question 6.
Which statement is true about invisible components?


Open Hint for Question 6 in a new window.
 
End of Question 6


Question 7.

Which statement(s) is (are) true about event-driven programming?
  1. Many of the methods that you write never will be invoked by your methods
  2. Event-handlers are invoked by your methods
  3. Event-listeners are methods that you write
  4. Event-handlers are invoked by event-listeners

Open Hint for Question 7 in a new window.
 
End of Question 7


Question 8.

Which statements are true?
  1. A border is one of kinds of components.
  2. The BorderFactory class allows one to create specifically designed borders.
  3. Borders can be used with most components.
  4. A component can have at most a single border - but, the border style may be "compound," including several border styles.

Open Hint for Question 8 in a new window.
 
End of Question 8


Question 9.

Which statements are true?
  1. A split pane always has at least one scroll bar.
  2. A scroll pane may not have any scroll bars.
  3. You cannot place a scroll pane within a split pane.
  4. You cannot place a split pane within a scroll pane.
  5. JLists can be used to display a selection list within either a split pane or a scroll pane.
  6. Only one item at a time may be selected in a JList.

Open Hint for Question 9 in a new window.
 
End of Question 9


Question 10.
Which statements are true?
  1. Every container has a layout manager.
  2. Every component has a layout manager.
  3. Every applet has a layout manager.
  4. To specify the absence of a layout manager, you use null.


Open Hint for Question 10 in a new window.
 
End of Question 10


Question 11.

Which statements are true?
  1. Examples of top-level (primary) containers are frames and applets.
  2. A container can have more than one layout manager.
  3. The appearance of a GUI is dependent upon how containers are contained within one another.
  4. The appearance of a GUI is dependent upon the layout managers used in its components.
  5. A layout manager specified at the top-level becomes the default layout manager for all contained components.
 
End of Question 11


Question 12.

Which statements are true?
  1. Flow layout puts as many components as possible on a row, at their preferred size.
  2. Flow layout left-justifies all the components in a row.
  3. Flow layout might arrange things so that all the components reside in a single row.
  4. Flow layout never arranges things so that all the components reside in a single column.

Open Hint for Question 12 in a new window.
 
End of Question 12


Question 13.

Which statements are true?
  1. Radio buttons and check boxes are both examples of button components.
  2. It makes sense to have a single check box in a GUI.
  3. It makes sense to have a single radio button in a GUI.
  4. Radio buttons generate both item events and action events.
  5. More than one radio button may be "set" at one time.

Open Hint for Question 13 in a new window.
 
End of Question 13


Question 14.

Which statements are true?
  1. If you enable a component, it appears "grayed out."
  2. A tool tip may be displayed if the mouse cursor rests on a component for a short time.
  3. Disabled components still "hear" events - and this information is passed on to the associated event handler.
  4. If a mnemonic is specified for a letter not in the label, button, menu item, the mnemonic will be essentially useless.

Open Hint for Question 14 in a new window.
 
End of Question 14


Question 15.

Which statements are true?
  1. In a grid layout, each grid cell can have a different size.
  2. In a box layout, each component's size will be adjusted by the layout manager so that all the sizes are the same.
  3. Box layouts have a user-specifiable gap to adjust the vertical and/or horizontal spacing.
  4. Only specific Swing components can be assigned a tool tip.
  5. Even if a component is disabled, a user still can activate it by using a mnemonic.

Open Hint for Question 15 in a new window.
 
End of Question 15





Pearson Copyright © 1995 - 2010 Pearson Education . All rights reserved. Pearson Addison Wesley is an imprint of Pearson .
Legal Notice | Privacy Policy | Permissions

Return to the Top of this Page