# Package com.codename1.ui.layouts

package com.codename1.ui.layouts

Layout managers allow a `com.codename1.ui.Container` to arrange its components by a set of rules that adapt to specific densities (ppi - pixels per inch). A layout manager is an arranging algorithm encapsulated by an abstract class implementation that places components absolutely based on the "hints" received.

Layout Managers that ship with Codename One

`com.codename1.ui.layouts.FlowLayout` is default layout manager, simple, flexible and with a few caveats.

`com.codename1.ui.layouts.BorderLayout` is ubiquitous thru Codename One code.

`com.codename1.ui.layouts.BorderLayout` can also behave differently based on the center behavior flag

`com.codename1.ui.layouts.BoxLayout` Y axis is a the work-horse of component lists

`com.codename1.ui.layouts.BoxLayout` X axis is a simpler replacement to flow layout and has grow/no grow variants.

`com.codename1.ui.layouts.GridLayout` arranges elements in a grid where all elements have an equal size. It can auto adapt the column count.

`com.codename1.ui.table.TableLayout` is similar in many regards to HTML tables. Notice that its in the `com.codename1.ui.table` package and not in this package.

`com.codename1.ui.layouts.LayeredLayout` is unique in the sense that it is meant to costruct layers and not the UI positions. It only lays out on the Z axis.

`com.codename1.ui.layouts.GridBagLayout` was added to Codename One to ease the porting of Swing/AWT applications.

`com.codename1.ui.layouts.mig.MigLayout` is a popular 3rd party layout manager its Codename One port is experimental.

- Related Packages
  Package
  Description
  com.codename1.ui
  Main widget package containing the component/container "composite" similar both in terminology and design to Swing/AWT.
  com.codename1.ui.layouts.mig
- Classes
  Class
  Description
  BorderLayout
  A border layout lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center.
  BoxLayout
  Layout manager that places elements in a row (`X_AXIS`) or column (`Y_AXIS`) according to box orientation.
  CoordinateLayout
  Allows laying out components based on absolute positions/sizes that are adapted based on available space for the layout.
  FlowLayout
  FlowLayout is the default layout manager for Codename One Containers and Forms.
  GridBagConstraints
  Port of the GridBag code from Apache's Harmony
  GridBagLayout
  Codename One port of the infamous GridBagLayout based on the Apache Harmony code.
  GridLayout
  The components are arranged in a grid based on available space, all cells in the grid are given exactly the same size which matches the largest preferred size or available space.
  GroupLayout
  GroupLayout is a LayoutManager that hierarchically groups components to achieve common, and not so common, layouts.
  Insets
  Port of Insets from Harmony for the use of the GridBag code
  LayeredLayout
  The `LayeredLayout` places the components in order one on top of the other and sizes them all to the size of the largest component.
  Layout
  Abstract class that can be used to arrange components in a container using a predefined algorithm.
  LayoutStyle
  LayoutStyle is used to determine how much space to place between components during layout.
  TextModeLayout
  This is a special case layout specifically designed for `com.codename1.ui.InputComponent`.