org.openbp.swing.plaf.sky
Class SimpleBorder

java.lang.Object
  extended by javax.swing.border.AbstractBorder
      extended by org.openbp.swing.plaf.sky.SimpleBorder
All Implemented Interfaces:
java.io.Serializable, javax.swing.border.Border

public class SimpleBorder
extends javax.swing.border.AbstractBorder

A rectangular border consisting of a single line. The line can have a particular color and width. Note that the insets of the border must be larger or equal than the width.

Author:
Jens Ferchland
See Also:
Serialized Form

Constructor Summary
SimpleBorder()
          Default constructor.
SimpleBorder(java.awt.Insets insets)
          Creates a new SimpleBorder instance with the given Insets between Border and Component.
SimpleBorder(int top, int left, int bottom, int right)
          Creates a new SimpleBorder instance with the given Insets between border and Component.
 
Method Summary
 java.awt.Insets getBorderInsets(java.awt.Component c)
          Gets the insets of the border
 java.awt.Color getColor()
          Gets the border color.
static SimpleBorder getStandardBorder()
          Gets the standard instance of this border.
 int getWidth()
          Gets the border width.
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
          Implements AbstractBorder.
 void setColor(java.awt.Color color)
          Sets the border color.
 void setWidth(int borderWidth)
          Sets the border width.
 
Methods inherited from class javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle, isBorderOpaque
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBorder

public SimpleBorder()
Default constructor.


SimpleBorder

public SimpleBorder(java.awt.Insets insets)
Creates a new SimpleBorder instance with the given Insets between Border and Component.

Parameters:
insets - The border insets

SimpleBorder

public SimpleBorder(int top,
                    int left,
                    int bottom,
                    int right)
Creates a new SimpleBorder instance with the given Insets between border and Component.

Parameters:
top - The top offset
left - The left offset
bottom - The bottom offset
right - The right offset
Method Detail

getStandardBorder

public static SimpleBorder getStandardBorder()
Gets the standard instance of this border.

Returns:
A simple border with inset 1 and default width and color

getWidth

public int getWidth()
Gets the border width.


setWidth

public void setWidth(int borderWidth)
Sets the border width.


getColor

public java.awt.Color getColor()
Gets the border color.

Returns:
The color or null for the default (gray)

setColor

public void setColor(java.awt.Color color)
Sets the border color.

Parameters:
color - The color or null for the default (gray)

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Implements AbstractBorder. Paints the Border around the Component.

Specified by:
paintBorder in interface javax.swing.border.Border
Overrides:
paintBorder in class javax.swing.border.AbstractBorder
Parameters:
c - a Component value
g - a Graphics value
x - an int value
y - an int value
width - an int value
height - an int value

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Gets the insets of the border

Specified by:
getBorderInsets in interface javax.swing.border.Border
Overrides:
getBorderInsets in class javax.swing.border.AbstractBorder
Parameters:
c - The component the border belongs to
Returns:
The border insets


Copyright © 2011. All Rights Reserved.