Switch (LAYOUT_MANAGERS) {

Now we look at different ways to organize controls on your panels.

Case: FLOW LAYOUT :

This is the simplest to use, and is used in many Swing examples in this book. In part, that's because you don't have to do much to make it go, and it is used by default by Jpanels. It arranges components in a flow—that is, by adding them in a certain direction. The effect is similar to typing into a word processor: as you add new words, they just get tacked onto the end. FlowLayout has three constructors.

  1. FlowLayout()

    Nuff said.

    There are two component orientations possible for a Flow Layout: left to right and right to left. They are

    ComponentOrientation.LEFT_TO_RIGHT
    ComponentOrientation.RIGHT_TO_LEFT
    

    You specify which you want to ...

Get Java Garage now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.