Home > Articles

This chapter is from the book

Quiz

Review this lesson’s material by taking this three-question quiz.

Questions

  • 1. Which of the following user interface components is not a container?

    • A. JScrollPane

    • B. JTextArea

    • C. JPanel

  • 2. Which component can be placed into a Scroll pane?

    • A. JTextArea

    • B. JTextField

    • C. Any component

  • 3. If you use setSize() on an application’s main frame, where will it appear on your desktop?

    • A. In the center of the desktop

    • B. In the same spot where the last application appeared

    • C. In the upper-left corner of the desktop

Answers

  • 1. B. JTextArea requires a container to support scrolling, but it is not a container itself.

  • 2. C. Any component can be added to a Scroll pane, but most are unlikely to need scrolling.

  • 3. C. This is a trick question. Calling setSize() has nothing to do with a window’s position on the desktop. You must call setBounds() rather than setSize() to choose where a frame will appear.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.