waba.ui
Class JustifiedContainer

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Container
              |
              +--waba.ui.JustifiedContainer

public class JustifiedContainer
extends Container

used to make a bit easy to place controls in a container. The controls must be inserted in horizontal order. isnt necessary to fill all the specified number of cols. example:

JustifiedContainer jc = new JustifiedContainer();
jc.setColumnCount(2);
jc.setGaps(0,6,0); // 6 pixels of horizontal gap
jc.setJustify(0,RIGHT,TOP); // justify column 0 at right
jc.add(0,new Label("Please fill the fields",Label.CENTER),0,0); // container width and preferred height
jc.add(0,new Label("Name:"),70,0); 
jc.add(1,new Edit(),0,0); // fill column 1 to the end
jc.add(0,new Label("Address:"),70,0); 
jc.add(1,new Edit(),0,0);


Field Summary
protected  int columnCount
          numero de colunas do container
protected  waba.ui.JustifiedContainer.Column[] columns
          colunas
 
Fields inherited from class waba.ui.Container
children, tail
 
Fields inherited from class waba.ui.Control
BOTTOM, CENTER, controlCount, enabled, FILL, fm, font, height, LEFT, name, next, parent, PREFERRED, prev, RIGHT, TOP, width, x, y
 
Constructor Summary
JustifiedContainer()
           
  . can be LEFT, RIGHT, TOP, BOTTOM, CENTER
Method Summary
 void add(int col, Control control, int controlW, int controlH)
          adds the control.
 void setColumnCount(int numcols)
          initialize the columns
 void setGaps(int col, int gapX, int gapY)
          set the gaps for the column
 void setJustify(int col, int justX, int justY)
          set the justifies of the column
 
Methods inherited from class waba.ui.Container
add, findChild, paintChildren, remove
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getAbsoluteRect, getFontMetrics, getNext, getParent, getPreferredHeight, getPreferredWidth, getRect, isEnabled, isVisible, onBoundsChanged, onEvent, onPaint, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, setEnabled, setFont, setRect, setRect, setVisible
 
Methods inherited from class java.lang.Object
hashCode, toString
 

Field Detail

columnCount

protected int columnCount
numero de colunas do container

columns

protected waba.ui.JustifiedContainer.Column[] columns
colunas
Constructor Detail

JustifiedContainer

public JustifiedContainer()
Method Detail

setColumnCount

public void setColumnCount(int numcols)
initialize the columns

setJustify

public void setJustify(int col,
                       int justX,
                       int justY)
set the justifies of the column . can be LEFT, RIGHT, TOP, BOTTOM, CENTER

setGaps

public void setGaps(int col,
                    int gapX,
                    int gapY)
set the gaps for the column

add

public void add(int col,
                Control control,
                int controlW,
                int controlH)
adds the control.
Parameters:
control - the specified control.
col - which column to add
controlW - if greater than 0: width of the control; if 0: fill to the end of the container width; if PREFERRED: preferred control width
controlH - if greater than 0: height of the control; if 0: default line height; if PREFERRED: preferred control height