Quiz: Swing Second Edition

   
By Matthew Robinson, April 2003    
Duke

This quiz is based on Matthew Robinsons' and Pavel Vorobiev's book, Swing Second Edition , a fast-paced guide to Swing with production quality code examples.

Choose the best answer(s) for each question, then click Submit to see how you scored.

 

  1. JComponent is the parent of almost all Swing components. It is a direct subclass of
     A. java.awt.Frame
     B. java.awt.Container
     C. java.lang.Object
  2. Respectively, Heavyweight and Lightweight components can (with a few exceptions) be grouped as follows:
     A. Swing and AWT components
     B. Frames and Panels
     C. AWT and Swing components
     D. Panels and Frames
  3. In Swing's Model View Controller (MVC) architecture, UI delegates typically encapsulate which of the following?:
     A. Model and View
     B. Model and Controller
     C. View and Controller
     D. Model, View and Controller
  4. All of the following AWT classes have direct equivalents in Swing except
     A. List
     B. Dialog
     C. Canvas
     D. Button
  5. When overriding a Swing component's rendering routine (without using UI delegates) you should override the following method:
     A. render()
     B. paint()
     C. paintComponent()
  6. JRootPane is used to manage:
     A. Component layering
     B. Painting and Rendering of components
     C. A container for a content pane, layered pane, menu bar and glass pane
  7. The default layout manager used by JPanel is
     A. None
     B. BorderLayout
     C. FlowLayout
     D. GridLayout
  8. When setting the layout used by a JFrame or JDialog you usually do something like
     A. Call myframe.getContentPane().setLayout(...
     B. Call myframe.setLayout(...
     C. Call myframe.getRootPane().setLayout(...
  9. The following class can be used to create "disabled" images:
     A. GrayFilter
     B. SwingConstants
     C. SwingUtilities
  10. By default, the new JSpinner component encapsulates
     A. A JTextArea, two JButtons and a JComboBox
     B. A JLayeredPane and three JButtons
     C. Two JButtons and a JComboBox
     D. Two JButtons and a JTextField
  11. JDesktopPane is an example of
     A. An MDI
     B. A subclass of JLayeredPane
     C. A container for JInternalFrames
     D. All of the above
  12. A cell renderer is?
     A. A component
     B. An object with a paint method
     C. A wombat
     D. $35
     E. None of the above

Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
JavaOne Banner Java 8 banner (182)