org.zaval.lw
Class LwBorder

java.lang.Object
  |
  +--org.zaval.util.ValidationObject
        |
        +--org.zaval.lw.LwView
              |
              +--org.zaval.lw.LwBorder
All Implemented Interfaces:
Validationable
Direct Known Subclasses:
LwTitledBorder

public class LwBorder
extends LwView

The class implements set of borders views. The library registers the views as static objects that can be used by the border view key. It is possible to use following keys to get a border view as a static object:


Field Summary
static int DOT
          The DOT border type.
static int ETCHED
          The ETCHED border type.
static int PLAIN
          The PLAIN border type.
static int RAISED
          The RAISED border type.
static int SUNKEN
          The SUNKEN border type.
static int SUNKEN2
          The SUNKEN2 border type.
 
Fields inherited from class org.zaval.lw.LwView
MOSAIC, ORIGINAL, STRETCH
 
Fields inherited from class org.zaval.util.ValidationObject
isValidFlag
 
Constructor Summary
LwBorder(int type)
          Constructs the new border view with the specified border type.
 
Method Summary
protected  void bottomLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
          Draws the bottom horizontal border line between the coordinates (x1,y1) and (x2,y2).
protected  java.awt.Dimension calcPreferredSize()
          Calculates and returns the view preferred size.
 int getBorderType()
          Gets the border type.
 java.awt.Insets getInsets()
          Gets the view insets.
protected  void leftLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
          Draws the left vertical border line between the coordinates (x1,y1) and (x2,y2).
 void paint(java.awt.Graphics g, int x, int y, int w, int h, Drawable d)
          Paints the view using a given width and height.
protected  void rightLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
          Draws the right vertical border line between the coordinates (x1,y1) and (x2,y2).
protected  void topLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
          Draws the top horizontal border line between the coordinates (x1,y1) and (x2,y2).
 
Methods inherited from class org.zaval.lw.LwView
getPreferredSize, getType, ownerChanged, paint, recalc, setType
 
Methods inherited from class org.zaval.util.ValidationObject
invalidate, isValid, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RAISED

public static final int RAISED
The RAISED border type.

SUNKEN

public static final int SUNKEN
The SUNKEN border type.

ETCHED

public static final int ETCHED
The ETCHED border type.

PLAIN

public static final int PLAIN
The PLAIN border type.

DOT

public static final int DOT
The DOT border type.

SUNKEN2

public static final int SUNKEN2
The SUNKEN2 border type.
Constructor Detail

LwBorder

public LwBorder(int type)
Constructs the new border view with the specified border type. The view uses STRETCH view type.
Parameters:
type - the specified border type.
Method Detail

getBorderType

public int getBorderType()
Gets the border type.
Returns:
a border type.

leftLine

protected void leftLine(java.awt.Graphics g,
                        int x1,
                        int y1,
                        int x2,
                        int y2)
Draws the left vertical border line between the coordinates (x1,y1) and (x2,y2).
Parameters:
g - the specified context to be used for drawing.
x1 - the x coordinate of the start of the line.
y1 - the y coordinate of the start of the line.
x2 - the x coordinate of the end of the line.
y2 - the y coordinate of the end of the line.

rightLine

protected void rightLine(java.awt.Graphics g,
                         int x1,
                         int y1,
                         int x2,
                         int y2)
Draws the right vertical border line between the coordinates (x1,y1) and (x2,y2).
Parameters:
g - the specified context to be used for drawing.
x1 - the x coordinate of the start of the line.
y1 - the y coordinate of the start of the line.
x2 - the x coordinate of the end of the line.
y2 - the y coordinate of the end of the line.

topLine

protected void topLine(java.awt.Graphics g,
                       int x1,
                       int y1,
                       int x2,
                       int y2)
Draws the top horizontal border line between the coordinates (x1,y1) and (x2,y2).
Parameters:
g - the specified context to be used for drawing.
x1 - the x coordinate of the start of the line.
y1 - the y coordinate of the start of the line.
x2 - the x coordinate of the end of the line.
y2 - the y coordinate of the end of the line.

bottomLine

protected void bottomLine(java.awt.Graphics g,
                          int x1,
                          int y1,
                          int x2,
                          int y2)
Draws the bottom horizontal border line between the coordinates (x1,y1) and (x2,y2).
Parameters:
g - the specified context to be used for drawing.
x1 - the x coordinate of the start of the line.
y1 - the y coordinate of the start of the line.
x2 - the x coordinate of the end of the line.
y2 - the y coordinate of the end of the line.

paint

public void paint(java.awt.Graphics g,
                  int x,
                  int y,
                  int w,
                  int h,
                  Drawable d)
Paints the view using a given width and height. The location where the view has to be painted is determined with x and y coordinates. This method is implemented with the border view and this defines face of the view.
Overrides:
paint in class LwView
Parameters:
g - the specified context to be used for painting.
x - the x coordinate.
y - the y coordinate.
w - the width of the view.
h - the height of the view.
d - the owner component.

getInsets

public java.awt.Insets getInsets()
Gets the view insets. The insets is used to calculate the owner component insets.
Overrides:
getInsets in class LwView
Returns:
an insets of the view.

calcPreferredSize

protected java.awt.Dimension calcPreferredSize()
Description copied from class: LwView
Calculates and returns the view preferred size. The method has not to use the view insets to compute the preferred size.
Overrides:
calcPreferredSize in class LwView
Following copied from class: org.zaval.lw.LwView
Returns:
a "pure" preferred size of the view.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org