org.zaval.lw
Class LwBorder
java.lang.Object
|
+--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 the following keys to get a border
view as a static object:
- "br.etched"
- "br.raised"
- "br.raised2"
- "br.sunken"
- "br.sunken2"
- "br.plain"
- "br.dot"
It is possible to specify a colors set that should be used to render the border. The colors set
is represented with the three colors: the brightest color, middle color and the darkest color.
Use on of the following ways to set the colors:
- By the border view class constructor.
- By default. In this case the "white", "gray" and "gray" colors will be used.
-
By the "lw.properties" file. For this purpose add the colors into the properties file
with the following keys: "br.c1", "br.c2", "br.c3".
The sample below illustrates how the borders set can be used for light weight components:
...
LwLabel label = new LwLabel("Label Text");
label.getViewMan(true).setBorder("br.dot");
...
|
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 |
RAISED2
The RAISED2 border type. |
static int |
SUNKEN
The SUNKEN border type. |
static int |
SUNKEN2
The SUNKEN2 border type. |
|
Constructor Summary |
LwBorder(int type)
Constructs the new border view with the specified border type.
|
LwBorder(int type,
java.awt.Color brightest,
java.awt.Color middle,
java.awt.Color darkest)
Constructs the new border view with the specified border type and the given colors set.
|
|
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. |
int |
getBottom()
Gets the bottom indent. |
int |
getLeft()
Gets the left indent. |
int |
getRight()
Gets the right indent. |
int |
getTop()
Gets the top indent. |
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,
Layoutable d)
Paints the view using the 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
RAISED2
public static final int RAISED2
- The RAISED2 border type.
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.
LwBorder
public LwBorder(int type,
java.awt.Color brightest,
java.awt.Color middle,
java.awt.Color darkest)
- Constructs the new border view with the specified border type and the given colors set.
The view uses STRETCH view type.
- Parameters:
type - the specified border type.brightest - the given brightest color.middle - the given middle color.darkest - the given darkest color.
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,
Layoutable d)
- Paints the view using the given width and height. The location where the
view has to be painted is determined with
x and y
coordinates. This method is implemented to define the
face of the border 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.
getTop
public int getTop()
- Description copied from class:
LwView
- Gets the top indent.
- Overrides:
getTop in class LwView
- Following copied from class:
org.zaval.lw.LwView
- Returns:
- a top indent.
getLeft
public int getLeft()
- Description copied from class:
LwView
- Gets the left indent.
- Overrides:
getLeft in class LwView
- Following copied from class:
org.zaval.lw.LwView
- Returns:
- a left indent.
getBottom
public int getBottom()
- Description copied from class:
LwView
- Gets the bottom indent.
- Overrides:
getBottom in class LwView
- Following copied from class:
org.zaval.lw.LwView
- Returns:
- a bottom indent.
getRight
public int getRight()
- Description copied from class:
LwView
- Gets the right indent.
- Overrides:
getRight in class LwView
- Following copied from class:
org.zaval.lw.LwView
- Returns:
- a right indent.
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.
|