: 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 LwBorderPan

java.lang.Object
  |
  +--org.zaval.lw.LwCanvas
        |
        +--org.zaval.lw.LwPanel
              |
              +--org.zaval.lw.LwBorderPan
All Implemented Interfaces:
Layoutable, LayoutContainer, LwComponent, LwContainer, LwLayout, TitleInfo, Validationable

public class LwBorderPan
extends LwPanel
implements LwLayout, TitleInfo

This is lightweight component that can be used to organize border panel. The panel can use any other component as a title and the title can be placed on the top or on the bottom line of the container. The border panel supports following alignments for the title: "left", "center", "right". The border panel implements and uses own layout manager, so to add a component to the container it is necessary to use one of the following constraints:

  • LwBorderPan.CENTER. The constraint is used to add a central component.
  • LwBorderPan.TITLE. The constraint is used to add a title component.

The table below shows different samples of the border panel usage:
Source code Application image
         ...
         LwBorderPan bp = new LwBorderPan();
         bp.setXAlignment(LwToolkit.CENTER);
         bp.add(LwBorderPan.TITLE,  new LwLabel("Title"));
         bp.add(LwBorderPan.CENTER, new LwLabel("Center"));
         ...
       
         ...
         LwBorderPan bp = new LwBorderPan();
         bp.setXAlignment(LwToolkit.LEFT);
         bp.add(LwBorderPan.TITLE,  new LwLabel("Title"));
         bp.add(LwBorderPan.CENTER, new LwLabel("Center"));
         ...
       
         ...
         LwBorderPan bp = new LwBorderPan();
         bp.setXAlignment(LwToolkit.RIGHT);
         bp.setTitleAlignment(LwToolkit.BOTTOM);
         bp.add(LwBorderPan.TITLE,  new LwLabel("Title"));
         bp.add(LwBorderPan.CENTER, new LwLabel("Center"));
         ...
       


Field Summary
static java.lang.Object CENTER
          The center layout constraint (it is used to add a central component).
static java.lang.Object TITLE
          The title layout constraint (it is used to add a title component).
 
Fields inherited from class org.zaval.lw.LwPanel
children
 
Fields inherited from class org.zaval.lw.LwCanvas
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y
 
Constructor Summary
LwBorderPan()
          Constructs a new border panel.
LwBorderPan(LwComponent title, LwComponent center)
          Constructs a new border panel with the specified title component and center component.
 
Method Summary
protected  int calcInsets(int type, int ci, int bi)
          Calculates and returns the given inset.
 java.awt.Dimension calcPreferredSize(LayoutContainer target)
          The method computes a preferred size for the specified target component.
 void componentAdded(java.lang.Object id, Layoutable lw, int index)
          The method is called if a component has been added to the owner layoutable container.
 void componentRemoved(Layoutable lw, int index)
          The method is called if a component has been removed from the owner layoutable container.
protected  LwLayout getDefaultLayout()
          Overrides parent method to define default layout.
 int getTitleAlignment()
          Gets the vertical alignment of the title component.
 java.awt.Rectangle getTitleBounds()
          Gets the rectangle where the title component has been placed with the border panel.
 void layout(LayoutContainer target)
          The method is an implementation of appropriate layout manager method.
 void setGaps(int vg, int hg)
          Sets the border panel layout gaps.
 void setTitleAlignment(int a)
          Sets the specified vertical alignment for the title of the border panel.
 void setXAlignment(int a)
          Sets the specified horizontal alignment for the title of the border panel.
 
Methods inherited from class org.zaval.lw.LwPanel
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, getPreferredSize, indexOf, insert, insert, invalidate, isInvalidatedByChild, laidout, paintOnTop, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, setSize, toFront, updateCashedPs, validate
 
Methods inherited from class org.zaval.lw.LwCanvas
canHaveFocus, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwParent, getOrigin, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isValid, isVisible, paint, recalc, repaint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setViewMan, setVisible, update, viewManChanged, vrp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.LwComponent
canHaveFocus, getBackground, getLwParent, getOrigin, getViewMan, getVisiblePart, isEnabled, isOpaque, paint, repaint, repaint, repaint, setEnabled, setInsets, setLwParent, setViewMan, setVisible, update
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getSize, getWidth, getX, getY, isVisible, setLocation
 
Methods inherited from interface org.zaval.util.Validationable
isValid
 

Field Detail

CENTER

public static final java.lang.Object CENTER
The center layout constraint (it is used to add a central component).

TITLE

public static final java.lang.Object TITLE
The title layout constraint (it is used to add a title component).
Constructor Detail

LwBorderPan

public LwBorderPan()
Constructs a new border panel.

LwBorderPan

public LwBorderPan(LwComponent title,
                   LwComponent center)
Constructs a new border panel with the specified title component and center component. In this case the title and the center components will be added to the border panel automatically
Parameters:
title - the specified title component.
center - the specified central component.
Method Detail

setGaps

public void setGaps(int vg,
                    int hg)
Sets the border panel layout gaps. The gaps are used as the vertical and horizontal indents to place a center component.
Parameters:
vg - the vertical layout gap.
hg - the horizontal layout gap.

componentAdded

public void componentAdded(java.lang.Object id,
                           Layoutable lw,
                           int index)
The method is called if a component has been added to the owner layoutable container. The implementation performs IllegalArgumentException if the constraint is not defined or doesn't equal LwBorderPan.TITLE or LwBorderPan.CENTER constant.
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)
The method is called if a component has been removed from the owner layoutable container.
Specified by:
componentRemoved in interface LwLayout
Parameters:
lw - the layoutable component.
index - the child index.

calcPreferredSize

public java.awt.Dimension calcPreferredSize(LayoutContainer target)
The method computes a preferred size for the specified target component.
Specified by:
calcPreferredSize in interface LwLayout
Parameters:
target - the specified layoutable container.

layout

public void layout(LayoutContainer target)
The method is an implementation of appropriate layout manager method. The method performs layouting of the child layoutable components for the specified target component.
Specified by:
layout in interface LwLayout
Parameters:
target - the specified layoutable container.

getDefaultLayout

protected LwLayout getDefaultLayout()
Overrides parent method to define default layout. The component returns itself as the default layout manager.
Overrides:
getDefaultLayout in class LwPanel
Returns:
the default layout manager.

getTitleBounds

public java.awt.Rectangle getTitleBounds()
Gets the rectangle where the title component has been placed with the border panel.
Specified by:
getTitleBounds in interface TitleInfo
Returns:
a rectangle where the the title component has been placed.

setTitleAlignment

public void setTitleAlignment(int a)
Sets the specified vertical alignment for the title of the border panel. The border panel supports LwToolkit.TOP and LwToolkit.BOTTOM values for the alignment, otherwise IllegalArgumentException will be thrown.
Parameters:
a - the vertical alignment.

setXAlignment

public void setXAlignment(int a)
Sets the specified horizontal alignment for the title of the border panel. The border panel supports LwToolkit.LEFT, LwToolkit.RIGHT and LwToolkit.CENTER values for the alignment, otherwise IllegalArgumentException will be thrown.
Parameters:
a - the horizontal alignment.

getTitleAlignment

public int getTitleAlignment()
Gets the vertical alignment of the title component.
Specified by:
getTitleAlignment in interface TitleInfo
Returns:
a vertical alignment.

calcInsets

protected int calcInsets(int type,
                         int ci,
                         int bi)
Description copied from class: LwCanvas
Calculates and returns the given inset.
Overrides:
calcInsets in class LwCanvas
Following copied from class: org.zaval.lw.LwCanvas
Parameters:
type - the inset type. Use LwToolkit.TOP, LwToolkit.LEFT, LwToolkit.RIGHT, LwToolkit.BOTTOM as the argument value.
ci - the component inset.
bi - the border inset.
Returns:
an inset.


: up