Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

Workshop 199

Workshop


To s e e w h e t h e r y o u r b r a i n c e l l s a r e l a i d o u t p r o p e r l y ,test your Java layout
management skills by answering the following questions.


Quiz



  1. What container is often used when subdividing an interface into differ-
    ent layout managers?
    A. JWindow
    B. JPanel
    C. Container

  2. What is the default layout manager for a panel?
    A. FlowLayout
    B. GridLayout
    B. No default

  3. TheBorderLayoutclass gets its name from where?
    A. The border of each component
    B. The way components are organized along the borders of a
    container
    C. Sheer capriciousness on the part of Java’s developers


Answers



  1. B.JPanel, which is the simplest of the containers.

  2. A.Panels use flow layout,but the default manager for frames and win-
    dows is grid layout.

  3. B.Yo u m u s t s p e c i f y t h e b o r d e r p o s i t i o n o f c o m p o n e n t s w i t h t h e u s e o f
    directional variables such as BorderLayout.WESTand
    BorderLayout.EASTas you add them to a container.

Free download pdf