What Is Layout?

This section describes AWT layout classes that can be used to layout components in a container. Commonly used layouts are BorderLayout, FlowLayout, BoxLayout, GridLayout, and GridBagLayout.

What Is Layout? A layout is a set of rules that defines how graphical components should be positioned in a container.

There two ways to position a component is a container:

AWT offers a number of predefined layouts for you to use:

Last update: 2014.

Table of Contents

 About This Book

 Introduction of Java Swing Package

 Graphics Environment of the Local System

 JFrame - Main Frame Class

 JLabel - Swing Label Class

 JButton - Swing Button Class

 JRadioButton - Swing Radio Button Class

 JTextField - Swing Text Field Class

 Menu Bar, Menus, Menu Items and Listeners

 Creating Internal Frames inside the Main Frame

Layout of Components in a Container

What Is Layout?

 java.awt.BorderLayout - Border Layout

 java.awt.FlowLayout - Flow Layout

 java.awt.BoxLayout - Box Layout

 java.awt.GridLayout - Grid Layout

 java.awt.GridBagLayout - Grid Bag Layout

 LookAndFeel and UIManager

 Option Dialog Boxes

 JEditorPane - The Editor Pane Class

 SwingWorker - The Background Task Worker

 References

 PDF Printing Version