Class RiverLayout

java.lang.Object
java.awt.FlowLayout
se.datadosen.component.RiverLayout
All Implemented Interfaces:
LayoutManager, Serializable

public class RiverLayout extends FlowLayout implements LayoutManager, Serializable

RiverLayout makes it very simple to construct user interfaces as components are laid out similar to how text is added to a word processor (Components flow like a "river". RiverLayout is however much more powerful than FlowLayout: Components added with the add() method generally gets laid out horizontally, but one may add a string before the component being added to specify "constraints" like this: add("br hfill", new JTextField("Your name here"); The code above forces a "line break" and extends the added component horizontally. Without the "hfill" constraint, the component would take on its preferred size.


List of constraints:
  • br - Add a line break
  • p - Add a paragraph break
  • tab - Add a tab stop (handy for constructing forms with labels followed by fields)
  • hfill - Extend component horizontally
  • vfill - Extent component vertically (only one line allowed per container) //$rh
  • left - Align following components to the left (default)
  • center - Align following components horizontally centered
  • right - Align following components to the right
  • vtop - Align following components vertically top aligned
  • vcenter - Align following components vertically centered (default)
RiverLayout is LGPL licenced - use it freely in free and commercial programs
See Also: