com.sas.visuals
Class TextBorder

com.sas.visuals.TextBorder
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.PublicClonable, com.sas.ViewInterface, BorderInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class TextBorder

TextBorder is a subclass of Border that draws Text on top of another Border. The text can be aligned horizontally or vertically and placed on either the top or the bottom side of the border.

See Also:
BorderInterface, Border, Serialized Form

Field Summary
protected  Border border
           
static int BOTTOM
          Text BOTTOM alignment
static int CENTER
          Text CENTER alignment
protected  java.awt.Component component
           
static int LEFT
          Text LEFT alignment
static int RIGHT
          Text RIGHT alignment
protected  java.lang.String text
           
protected  int textBorderGap
           
protected  java.awt.Color textColor
           
protected  java.awt.Font textFont
           
protected  int textHAlignment
           
protected  int textMargin
           
protected  int textPosition
           
protected  int textVAlignment
           
static int TOP
          Text TOP alignment
 
Fields inherited from class com.sas.visuals.Border
baseColor, baseColorJ, borderWidth, lightSource, RB_KEY, style
 
Fields inherited from interface com.sas.visuals.BorderInterface
BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, LOWERED, NONE, RAISED, TOP_LEFT, TOP_RIGHT
 
Constructor Summary
TextBorder()
          Default constructor.
TextBorder(java.awt.Component comp, java.lang.String txt)
          Constructor that sets the component and text to use.
TextBorder(java.awt.Component comp, java.lang.String txt, Border b)
          Constructor that sets the component, text, and border to use.
TextBorder(java.awt.Component comp, java.lang.String txt, Border b, int textHAlign, int textVAlign, int textPos)
          Constructor that sets several attributes of the TextBorder.
TextBorder(java.awt.Component comp, java.lang.String txt, Border b, int textHAlign, int textVAlign, int textPos, java.awt.Font f)
          Constructor that sets several attributes of the TextBorder.
TextBorder(java.awt.Component comp, java.lang.String txt, Border b, int textHAlign, int textVAlign, int textPos, java.awt.Font f, java.awt.Color c)
          Constructor that sets several attributes of the TextBorder.
 
Method Summary
 void drawInRect(java.awt.Component comp, java.awt.Graphics g, int x, int y, int width, int height)
          Draw the Border within the specified rectangle on the specified component.
 Border getBorder()
          Get the border the text is being drawn on
 java.awt.Component getComponent()
          Get the component used to get the font and background/foreground color information to draw the border.
 int getHorizontalAlignment()
          Get the horizontal alignment of the text.
 java.awt.Insets getInsets(java.awt.Component comp)
          Get the Insets of the Border on the specified component.
 java.lang.String getText()
          Get the text drawn on the border.
 int getTextBorderGap()
          Get the pixel gap between the border and the text when the vertical alignment is not CENTER.
 java.awt.Color getTextColor()
          Get the color used to draw the text
 java.awt.Font getTextFont()
          Get the font used to draw the text
protected  int getTextHeight(java.awt.Component c)
          Get the height of the text based on the specified component.
 int getTextMargin()
          Get the pixel margin for the text when it is aligned to the LEFT or the RIGHT side.
 int getTextPosition()
          Get the side the text is positioned on.
 int getVerticalAlignment()
          Get the vertical alignment of the text.
 void setBorder(Border b)
          Set the border to draw the text on.
 void setComponent(java.awt.Component comp)
          Set the component to get the font an foreground/background color information from.
 void setHorizontalAlignment(int hAlign)
          Set the horizontal alignment of the text.
 void setText(java.lang.String txt)
          Set the text to draw on the border.
 void setTextBorderGap(int gap)
          Set the pixel gap between the border and the text when the vertical alignment is not CENTER.
 void setTextColor(java.awt.Color c)
          Set the color used to draw the text.
 void setTextFont(java.awt.Font f)
          Set the font used to draw the text.
 void setTextMargin(int margin)
          Set the pixel margin for the text when it is aligned to the LEFT or the RIGHT side.
 void setTextPosition(int textPos)
          Set the side the text is positioned on.
 void setVerticalAlignment(int vAlign)
          Set the vertical alignment of the text.
 
Methods inherited from class com.sas.visuals.Border
clone, drawInRect, drawInRect, drawInRect, equals, getBaseColor, getBorderWidth, getBottomMargin, getExtendedBeanInfo, getInsets, getInteriorBounds, getInteriorBounds, getLeftMargin, getLightSource, getRightMargin, getStyle, getTopMargin, hashCode, paramString, setBaseColor, setBorderWidth, setLightSource, setStyle, toString
 

Field Detail

CENTER

public static final int CENTER
Text CENTER alignment

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Text RIGHT alignment

See Also:
Constant Field Values

LEFT

public static final int LEFT
Text LEFT alignment

See Also:
Constant Field Values

TOP

public static final int TOP
Text TOP alignment

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Text BOTTOM alignment

See Also:
Constant Field Values

text

protected java.lang.String text

textBorderGap

protected int textBorderGap

textPosition

protected int textPosition

textHAlignment

protected int textHAlignment

textVAlignment

protected int textVAlignment

textMargin

protected int textMargin

textFont

protected java.awt.Font textFont

textColor

protected java.awt.Color textColor

border

protected Border border

component

protected java.awt.Component component
Constructor Detail

TextBorder

public TextBorder()
Default constructor.


TextBorder

public TextBorder(java.awt.Component comp,
                  java.lang.String txt)
Constructor that sets the component and text to use.

Parameters:
comp - the component used to setup the font and background/foreground colors
txt - the text to be displayed on the border

TextBorder

public TextBorder(java.awt.Component comp,
                  java.lang.String txt,
                  Border b)
Constructor that sets the component, text, and border to use.

Parameters:
comp - the component used to setup the font and background/foreground colors
txt - the text to be displayed on the border
b - the border to draw the text on

TextBorder

public TextBorder(java.awt.Component comp,
                  java.lang.String txt,
                  Border b,
                  int textHAlign,
                  int textVAlign,
                  int textPos)
Constructor that sets several attributes of the TextBorder.

Parameters:
comp - the component used to setup the font and background/foreground colors
txt - the text to be displayed on the border
b - the border to draw the text on
textHAlign - the horizontal alignment of the text
textVAlign - the vertical alignment of the text
textPos - the side of the border the text is positioned on

TextBorder

public TextBorder(java.awt.Component comp,
                  java.lang.String txt,
                  Border b,
                  int textHAlign,
                  int textVAlign,
                  int textPos,
                  java.awt.Font f)
Constructor that sets several attributes of the TextBorder.

Parameters:
comp - the component used to setup the font and background/foreground colors
txt - the text to be displayed on the border
b - the border to draw the text on
textHAlign - the horizontal alignment of the text
textVAlign - the vertical alignment of the text
textPos - the side of the border the text is positioned on
f - the font used to draw the text

TextBorder

public TextBorder(java.awt.Component comp,
                  java.lang.String txt,
                  Border b,
                  int textHAlign,
                  int textVAlign,
                  int textPos,
                  java.awt.Font f,
                  java.awt.Color c)
Constructor that sets several attributes of the TextBorder.

Parameters:
comp - the component used to setup the font and background/foreground colors
txt - the text to be displayed on the border
b - the border to draw the text on
textHAlign - the horizontal alignment of the text
textVAlign - the vertical alignment of the text
textPos - the side of the border the text is positioned on
f - the font used to draw the text
c - the color used to draw the text
Method Detail

drawInRect

public void drawInRect(java.awt.Component comp,
                       java.awt.Graphics g,
                       int x,
                       int y,
                       int width,
                       int height)
Draw the Border within the specified rectangle on the specified component.

Specified by:
drawInRect in interface BorderInterface
Specified by:
drawInRect in class Border
Parameters:
comp - the java.awt.Component to draw the border on, can be null
g - the Graphics context
x - the x position of the border rectangle
y - the y position of the border rectangle
width - the width of the border rectangle
height - the height of the border rectangle
See Also:
BorderInterface

getBorder

public Border getBorder()
Get the border the text is being drawn on


getComponent

public java.awt.Component getComponent()
Get the component used to get the font and background/foreground color information to draw the border.


getHorizontalAlignment

public int getHorizontalAlignment()
Get the horizontal alignment of the text.

Returns:
the alignment can be: LEFT, RIGHT, or CENTER

getInsets

public java.awt.Insets getInsets(java.awt.Component comp)
Get the Insets of the Border on the specified component.

Specified by:
getInsets in interface BorderInterface
Specified by:
getInsets in class Border
Parameters:
comp - the component to draw the border on, can be null.
Returns:
the Insets of the Border.

getText

public java.lang.String getText()
Get the text drawn on the border.


getTextBorderGap

public int getTextBorderGap()
Get the pixel gap between the border and the text when the vertical alignment is not CENTER.


getTextColor

public java.awt.Color getTextColor()
Get the color used to draw the text


getTextFont

public java.awt.Font getTextFont()
Get the font used to draw the text


getTextHeight

protected int getTextHeight(java.awt.Component c)
Get the height of the text based on the specified component.


getTextMargin

public int getTextMargin()
Get the pixel margin for the text when it is aligned to the LEFT or the RIGHT side.


getTextPosition

public int getTextPosition()
Get the side the text is positioned on.

Returns:
the text can be on the TOP or BOTTOM sides.

getVerticalAlignment

public int getVerticalAlignment()
Get the vertical alignment of the text.

Returns:
the alignment can be: TOP, BOTTOM, or CENTER

setBorder

public void setBorder(Border b)
Set the border to draw the text on.


setComponent

public void setComponent(java.awt.Component comp)
Set the component to get the font an foreground/background color information from.


setHorizontalAlignment

public void setHorizontalAlignment(int hAlign)
Set the horizontal alignment of the text.

Parameters:
hAlign - the alignment can be: LEFT, RIGHT, or CENTER

setText

public void setText(java.lang.String txt)
Set the text to draw on the border.


setTextBorderGap

public void setTextBorderGap(int gap)
Set the pixel gap between the border and the text when the vertical alignment is not CENTER.


setTextColor

public void setTextColor(java.awt.Color c)
Set the color used to draw the text. If the color is set to null the text will use the color from the component property.


setTextFont

public void setTextFont(java.awt.Font f)
Set the font used to draw the text. If the font is set to null the text will use the font from the component property.


setTextMargin

public void setTextMargin(int margin)
Set the pixel margin for the text when it is aligned to the LEFT or the RIGHT side.


setTextPosition

public void setTextPosition(int textPos)
Set the side the text is positioned on.

Parameters:
textPos - the text can be on the TOP or BOTTOM sides.

setVerticalAlignment

public void setVerticalAlignment(int vAlign)
Set the vertical alignment of the text.

Parameters:
vAlign - the alignment can be: TOP, BOTTOM, or CENTER



Copyright © 2009 SAS Institute Inc. All Rights Reserved.