edu.wisc.ssec.mcidasv.ui
Class PartialLineBorder

java.lang.Object
  extended by javax.swing.border.AbstractBorder
      extended by javax.swing.border.LineBorder
          extended by edu.wisc.ssec.mcidasv.ui.PartialLineBorder
All Implemented Interfaces:
Serializable, Border

public class PartialLineBorder
extends LineBorder

This is a better version of LineBorder which allows you to show line only at one side or several sides and supports rounded corner.

See Also:
Serialized Form

Field Summary
private  int _roundedCornerSize
           
private  int _sides
           
(package private) static int ALL
           
(package private) static int EAST
           
(package private) static int HORIZONTAL
           
(package private) static int NORTH
           
(package private) static int SOUTH
           
(package private) static int VERTICAL
           
(package private) static int WEST
           
 
Fields inherited from class javax.swing.border.LineBorder
lineColor, roundedCorners, thickness
 
Constructor Summary
PartialLineBorder(Color color)
           
PartialLineBorder(Color color, int thickness)
           
PartialLineBorder(Color color, int thickness, boolean roundedCorners)
           
PartialLineBorder(Color color, int thickness, boolean roundedCorners, int roundedCornerSize)
           
PartialLineBorder(Color color, int thickness, int side)
           
 
Method Summary
 Insets getBorderInsets(Component c)
           
 Insets getBorderInsets(Component c, Insets insets)
           
 int getRoundedCornerSize()
           
 int getSides()
           
 void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
           
private static void restoreShapeAntialiasing(Graphics g, Object oldHints)
          Restores the old setting for shape anti-alias.
 void setRoundedCornerSize(int roundedCornerSize)
           
 void setSides(int sides)
           
private static Object setupShapeAntialiasing(Graphics g)
          Setups the graphics to draw shape using anti-alias.
 
Methods inherited from class javax.swing.border.LineBorder
createBlackLineBorder, createGrayLineBorder, getLineColor, getRoundedCorners, getThickness, isBorderOpaque
 
Methods inherited from class javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORTH

static final int NORTH
See Also:
Constant Field Values

SOUTH

static final int SOUTH
See Also:
Constant Field Values

EAST

static final int EAST
See Also:
Constant Field Values

WEST

static final int WEST
See Also:
Constant Field Values

HORIZONTAL

static final int HORIZONTAL
See Also:
Constant Field Values

VERTICAL

static final int VERTICAL
See Also:
Constant Field Values

ALL

static final int ALL
See Also:
Constant Field Values

_sides

private int _sides

_roundedCornerSize

private int _roundedCornerSize
Constructor Detail

PartialLineBorder

public PartialLineBorder(Color color)

PartialLineBorder

public PartialLineBorder(Color color,
                         int thickness)

PartialLineBorder

public PartialLineBorder(Color color,
                         int thickness,
                         boolean roundedCorners)

PartialLineBorder

public PartialLineBorder(Color color,
                         int thickness,
                         boolean roundedCorners,
                         int roundedCornerSize)

PartialLineBorder

public PartialLineBorder(Color color,
                         int thickness,
                         int side)
Method Detail

getSides

public int getSides()

setSides

public void setSides(int sides)

getRoundedCornerSize

public int getRoundedCornerSize()

setRoundedCornerSize

public void setRoundedCornerSize(int roundedCornerSize)

paintBorder

public void paintBorder(Component c,
                        Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Specified by:
paintBorder in interface Border
Overrides:
paintBorder in class LineBorder

getBorderInsets

public Insets getBorderInsets(Component c)
Specified by:
getBorderInsets in interface Border
Overrides:
getBorderInsets in class LineBorder

getBorderInsets

public Insets getBorderInsets(Component c,
                              Insets insets)
Overrides:
getBorderInsets in class LineBorder

setupShapeAntialiasing

private static Object setupShapeAntialiasing(Graphics g)
Setups the graphics to draw shape using anti-alias.

Parameters:
g -
Returns:
the old hints. You will need this value as the third parameter in restoreShapeAntialiasing(java.awt.Graphics,Object).

restoreShapeAntialiasing

private static void restoreShapeAntialiasing(Graphics g,
                                             Object oldHints)
Restores the old setting for shape anti-alias.

Parameters:
g -
oldHints - the value returned from setupShapeAntialiasing(java.awt.Graphics).