edu.princeton.swing
Class PHyperlink.UnderlineBorder

java.lang.Object
  extended by javax.swing.border.AbstractBorder
      extended by edu.princeton.swing.PHyperlink.UnderlineBorder
All Implemented Interfaces:
Serializable, Border
Enclosing class:
PHyperlink

public static class PHyperlink.UnderlineBorder
extends AbstractBorder

UnderlineBorder is a simple subclass of AbstractBorder that draws an underline.

See Also:
Serialized Form

Constructor Summary
PHyperlink.UnderlineBorder(Color color, int pad, int thickness)
          Creates a new UnderlineBorder.
 
Method Summary
 Insets getBorderInsets(Component c)
          Returns the insets of the border.
 Insets getBorderInsets(Component c, Insets insets)
          Reinitialize the insets parameter with this Border's current Insets.
 Color getColor()
          Returns the color of the border.
 int getPad()
          Returns the number of pixels of transparent space before the underline.
 int getThickness()
          Returns the thickness of the underline.
 boolean isBorderOpaque()
          Returns whether or not the border is opaque.
 void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
          Paints the border for the specified component with the specified position and size.
 
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
 

Constructor Detail

PHyperlink.UnderlineBorder

public PHyperlink.UnderlineBorder(Color color,
                                  int pad,
                                  int thickness)
Creates a new UnderlineBorder.

Parameters:
color - The color of the border. If null is passed, the underline will be drawn with the Component's foreground color.
pad - The number of pixels of transparent space before the underline. Negative values will result in an IllegalArgumentException.
thickness - The thickness of the underline. Negative values will result in an IllegalArgumentException.
Method Detail

getColor

public Color getColor()
Returns the color of the border. A null value indicates that the the underline will be drawn with the Component's foreground color.

Returns:
The color of the border.

getPad

public int getPad()
Returns the number of pixels of transparent space before the underline.

Returns:
The number of pixels of transparent space before the underline.

getThickness

public int getThickness()
Returns the thickness of the underline.

Returns:
The thickness of the underline.

paintBorder

public void paintBorder(Component c,
                        Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Paints the border for the specified component with the specified position and size.

Specified by:
paintBorder in interface Border
Overrides:
paintBorder in class AbstractBorder

getBorderInsets

public Insets getBorderInsets(Component c)
Returns the insets of the border.

Specified by:
getBorderInsets in interface Border
Overrides:
getBorderInsets in class AbstractBorder

getBorderInsets

public Insets getBorderInsets(Component c,
                              Insets insets)
Reinitialize the insets parameter with this Border's current Insets.

Overrides:
getBorderInsets in class AbstractBorder

isBorderOpaque

public boolean isBorderOpaque()
Returns whether or not the border is opaque.

Specified by:
isBorderOpaque in interface Border
Overrides:
isBorderOpaque in class AbstractBorder