: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
Screen Shots
On-line Demos
Requirements
Further Plans
Docs
Tutorial
How-to (PDF)
API
FAQ
Download
Latest version

Home > J2SE > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

org.zaval.lw
Class LwFlowLayout

java.lang.Object
  |
  +--org.zaval.lw.LwFlowLayout
All Implemented Interfaces:
LwLayout

public class LwFlowLayout
extends java.lang.Object
implements LwLayout

This class implements layout manager interface. The implementation places child components according to the following three parameters : direction (can be LwToolkit.HORIZONTAL or LwToolkit.VERTICAL), vertical alignment (LwToolkit.TOP, LwToolkit.BOTTOM, LwToolkit.CENTER) and horizontal alignment (LwToolkit.LEFT, LwToolkit.RIGHT, LwToolkit.CENTER).

The first parameter defines direction, if the direction is LwToolkit.VERTICAL than every following component will be added under the previous, otherwise every following component will be added to the right of the previous.

The vertical and horizontal alignments define how the child components will be laid out relatively the parent container. The table below shows the samples of the layout manager usage:
Direction Horizontal alignment Vertical alignment Sample App
LwToolkit.HORIZONTAL LwToolkit.LEFT LwToolkit.TOP
LwToolkit.VERTICAL LwToolkit.LEFT LwToolkit.TOP
LwToolkit.VERTICAL LwToolkit.RIGHT LwToolkit.TOP
LwToolkit.HORIZONTAL LwToolkit.CENTER LwToolkit.CENTER
LwToolkit.HORIZONTAL LwToolkit.CENTER LwToolkit.BOTTOM


Constructor Summary
LwFlowLayout()
          Constructs a new flow layout manager with default parameters.
LwFlowLayout(int ax, int ay)
          Constructs a new flow layout manager with the specified horizontal and vertical alignments.
LwFlowLayout(int ax, int ay, int dir)
          Constructs a new flow layout manager with the specified horizontal, vertical alignments and the direction.
LwFlowLayout(int ax, int ay, int dir, int g)
          Constructs a new flow layout manager with the specified horizontal, vertical alignments, the direction and the given gap.
 
Method Summary
 java.awt.Dimension calcPreferredSize(LayoutContainer c)
          Calculates the preferred size dimensions for the layout container.
 void componentAdded(java.lang.Object id, Layoutable lw, int index)
          Invoked when the specified layoutable component is added to the layout container (that uses the layout manager).
 void componentRemoved(Layoutable lw, int index)
          Invoked when the specified layoutable component is removed from the layout container, that uses the layout manager.
 int getGap()
          Gets the gap.
 void layout(LayoutContainer c)
          Lays out the child layoutable components inside the layout container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LwFlowLayout

public LwFlowLayout()
Constructs a new flow layout manager with default parameters. In this case the direction property is LwToolkit.HORIZONTAL, the horizontal alignment is LwToolkit.LEFT and the vertical alignment is LwToolkit.TOP.

LwFlowLayout

public LwFlowLayout(int ax,
                    int ay)
Constructs a new flow layout manager with the specified horizontal and vertical alignments. In this case the direction property is LwToolkit.HORIZONTAL.
Parameters:
ax - the specified horizontal alignment.
ay - the specified vertical alignment.

LwFlowLayout

public LwFlowLayout(int ax,
                    int ay,
                    int dir)
Constructs a new flow layout manager with the specified horizontal, vertical alignments and the direction.
Parameters:
ax - the specified horizontal alignment.
ay - the specified vertical alignment.
dir - the specified direction.

LwFlowLayout

public LwFlowLayout(int ax,
                    int ay,
                    int dir,
                    int g)
Constructs a new flow layout manager with the specified horizontal, vertical alignments, the direction and the given gap.
Parameters:
ax - the specified horizontal alignment.
ay - the specified vertical alignment.
dir - the specified direction.
g - the specified gap.
Method Detail

calcPreferredSize

public java.awt.Dimension calcPreferredSize(LayoutContainer c)
Calculates the preferred size dimensions for the layout container. The method calculates "pure" preferred size, it means that an insets of the container is not considered.
Specified by:
calcPreferredSize in interface LwLayout
Parameters:
c - the layout container.

layout

public void layout(LayoutContainer c)
Lays out the child layoutable components inside the layout container.
Specified by:
layout in interface LwLayout
Parameters:
c - the layout container that needs to be laid out.

getGap

public int getGap()
Gets the gap.
Returns:
a gap.

componentAdded

public void componentAdded(java.lang.Object id,
                           Layoutable lw,
                           int index)
Invoked when the specified layoutable component is added to the layout container (that uses the layout manager). The specified constraints, layoutable component and child index are passed as arguments into the method. The layout manager doesn't use any constraints, so the method is empty for the manager.
Specified by:
componentAdded in interface LwLayout
Parameters:
id - the layoutable component constraints.
lw - the layoutable component.
index - the child index.

componentRemoved

public void componentRemoved(Layoutable lw,
                             int index)
Invoked when the specified layoutable component is removed from the layout container, that uses the layout manager.
Specified by:
componentRemoved in interface LwLayout
Parameters:
lw - the layoutable component to be removed
index - the child index.


: up