The property Layout defines the allignment of components in a container or a panel. Additional the allignment can be affected by the Constraints property, depending on the selected layout. Depending on the selected layout the Size properties of components affect the allignment.
The null Layout displays all components as they were arranged in the design window. The components are placed and displayed as specified by the Bounds property(s. fig. 69 ).
The BorderLayout contains five areas: Northn, East, South, West and Center. The center part if flexible in size. The areas North and South are flexible in with, the areas East and West are flexible in height. Size and position of the components are defined by the layout and the PreferredSize property of the components (s. fig. 70 ).
| Hgap | Horizontal gap between the components |
| Vgap | Vertikal gap between the components |
See How to Use BorderLayout in the Java Tutorial.
The BoxLayout alligns components either horizontal or vertikal (s. fig. 71 ).
| Axis | There are four kinds of alignments | ||
| X Axis | Elemente werden horizontal von links nach rechts angeordnet | ||
| Y Axis | Elemente werden vertikal von oben nach unten angeordnet | ||
| Line Axis | Elemente werden vergleichbar mit Wörter in einer Zeile ausgerichtet, abhängig von der Orientation Eigenschaft des Containers | ||
| Page Axis | Elemente werden vergleichbar mit Textzeilen auf einer Seite ausgerichtet, abhängig von der Orientation Eigenschaft des Containers | ||
See How to Use BoxLayout in the Java Tutorial.
The CardLayout alligns the components one over an other. Always the upper component will be shown. Size and position of the components are defined by the layout (s. fig. 72 ).
| Hgap | Horizontal gap between the components |
| Vgap | Vertikal gap between the components |
See How to Use CardLayout in the Java Tutorial.
The components are oredered from left to right. The components keek their size If the components are too width for one row, they will be alligned in the next row (s. fig. 73 ).
| Allingment | Ausrichtung der eingefügten Komponenten: Links, Zentriert, Rechts, Führend, Schleppend |
| Hgap | Horizontal gap between the components |
| Vgap | Vertikal gap between the components |
See How to Use FlowLayout in the Java Tutorial.
The components are alligned in flexible cells. Size and position of the components are defined by the layout (s. fig. 74 ).
| Rows | The number of rows |
| Columns | The number of columns |
| Hgap | Horizontal gap between the components |
| Vgap | Vertikal gap between the components |
Weitere Informationen in How to Use GridLayout im Java Tutorial.
The GridBagLayout is a very flexible layout. It devides the container in grids that can be connected. Size and position of the components will be defined by the Layout and the Constarints property of the components (s. fig. 8).
See How to Use GridBagLayout in the Java Tutorial.