The JFC Swing Tutorial: A Guide to Constructing GUIs (2nd Edition)

 <  Day Day Up  >  

http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

Each of the following how-to sections describes how to use a particular layout manager ”an object that controls the size and position of components in a container. These sections are organized alphabetically for quick reference. To see pictures of typical uses of each layout manager, you can refer to A Visual Guide to Layout Managers (page 88) in Chapter 4.

All of these sections assume that you're familiar with layout management concepts. These prerequisites are covered in Chapter 4, Laying Out Components within a Container (page 87). Chapter 4 also includes instructions on how to use absolute positioning (no layout manager) and an example of writing a custom layout manager. If you have any difficulties, be sure to refer to Solving Common Layout Problems (page 738) in the Appendix.

You can find source files for all the examples in this chapter on the CD and online:

JavaTutorial/uiswing/layout/example-1dot4/index.html

http://java.sun.com/docs/books/tutorial/uiswing/layout/example-1dot4/index.html

The preceding URLs take you to an example index that has links to the files required by each example. You can go directly to the entry for a particular example by adding # ExampleName to the URL. Most examples have a "Run" link in the index which executes the example using Java Web Start technology.

How to Use BorderLayout

The BorderLayout API

Examples That Use BorderLayout

How to Use BoxLayout

BoxLayout Features

Using Invisible Components as Filler

Fixing Alignment Problems

Specifying Component Sizes

The Box Layout API

Examples That Use Box Layouts

How to Use CardLayout

The CardLayout API

Examples That Use CardLayout

How to Use FlowLayout

The FlowLayout API

Examples That Use FlowLayout

How to Use GridBagLayout

Specifying Constraints

The Example Explained

The GridBagLayout API

Examples That Use GridBagLayout

How to Use GridLayout

The GridLayout API

Examples That Use GridLayout

How to Use SpringLayout

How Spring Layouts Work

Example: SpringDemo

Springs and Component Size

Alternative Expressions

Utility Methods for Grids

The SpringLayout API

Examples That Use SpringLayout

 <  Day Day Up  >  

Категории