O'Reilly logo

Java Garage by Eben Hewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required