com.jstatcom.component
Class MatrixBorder

java.lang.Object
  extended by javax.swing.border.AbstractBorder
      extended by com.jstatcom.component.MatrixBorder
All Implemented Interfaces:
java.io.Serializable, javax.swing.border.Border

public final class MatrixBorder
extends javax.swing.border.AbstractBorder

This border puts angular brackets [ ] around a component. It can be used to visualize a matrix or a range object. The appearance of the brackets can be configured via the constructor, but reasonable defaults are provided by static factory methods as well.

Author:
A. Benkwitz, Markus Kraetzig
See Also:
Serialized Form

Constructor Summary
MatrixBorder()
          Creates the default MatrixBorder instance.
MatrixBorder(int thick, int width, int outerTop, int innerTop, int outerLeft, int innerLeft)
          Creates a MatrixBorder instance according to spacing and size parameters.
 
Method Summary
 java.awt.Insets getBorderInsets(java.awt.Component c)
          Overrides super method.
 java.awt.Insets getBorderInsets(java.awt.Component c, java.awt.Insets insets)
          Reinitialize the insets parameter with this border's current insets.
static MatrixBorder getInstanceSmall()
          Gets a MatrixBorder that is smaller than the default, for example to be used with default sized text fields.
static MatrixBorder getInstanceThick()
          Gets a MatrixBorder that is thicker than the default.
 boolean isBorderOpaque()
          This default implementation returns false.
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
          Called by the repaint manager to paint this border.
 
Methods inherited from class javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixBorder

public MatrixBorder()
Creates the default MatrixBorder instance.


MatrixBorder

public MatrixBorder(int thick,
                    int width,
                    int outerTop,
                    int innerTop,
                    int outerLeft,
                    int innerLeft)
Creates a MatrixBorder instance according to spacing and size parameters. Instead of this constructor, the static factory methods can be called for some reasonable variations of the default MatrixBorder.

Parameters:
thick - border thickness, default is 1
width - width of the brackets, default is 8
outerTop - space between outer top and bracket, default is 1
innerTop - space between bracket and top of component, default is 3
outerLeft - space between outer left and bracket, default is 1
innerLeft - space between bracket and left of component, default is 3
Method Detail

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Overrides super method.

Specified by:
getBorderInsets in interface javax.swing.border.Border
Overrides:
getBorderInsets in class javax.swing.border.AbstractBorder
Parameters:
c - the component for which this border insets value applies
Returns:
the insets

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c,
                                       java.awt.Insets insets)
Reinitialize the insets parameter with this border's current insets. Overrides super method.

Overrides:
getBorderInsets in class javax.swing.border.AbstractBorder
Parameters:
c - the component for which this border insets value applies
insets - the object to be reinitialized
Returns:
the insets

getInstanceSmall

public static MatrixBorder getInstanceSmall()
Gets a MatrixBorder that is smaller than the default, for example to be used with default sized text fields.

Returns:
a new border instance

getInstanceThick

public static MatrixBorder getInstanceThick()
Gets a MatrixBorder that is thicker than the default.

Returns:
a new border instance

isBorderOpaque

public boolean isBorderOpaque()
This default implementation returns false. Overrides super method.

Specified by:
isBorderOpaque in interface javax.swing.border.Border
Overrides:
isBorderOpaque in class javax.swing.border.AbstractBorder
Returns:
false

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Called by the repaint manager to paint this border.

Specified by:
paintBorder in interface javax.swing.border.Border
Overrides:
paintBorder in class javax.swing.border.AbstractBorder