public abstract class AbstractLabeledBorder extends AbstractBorder implements LabeledBorder
tempRect
Constructor and Description |
---|
AbstractLabeledBorder()
Constructs a default AbstractLabeledBorder with the name of this class
set as its label.
|
AbstractLabeledBorder(java.lang.String s)
Constructs a border with the label set to the String passed in as input.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Insets |
calculateInsets(IFigure figure)
Calculates insets based on the current font and other attributes.
|
protected Font |
getFont(IFigure f)
Returns the font that this border will use.
|
Insets |
getInsets(IFigure fig)
Returns the insets, or space associated for this border.
|
java.lang.String |
getLabel()
Returns the label for this Border.
|
Dimension |
getPreferredSize(IFigure fig)
Returns the preferred width and height that this border would like to
display itself properly.
|
Color |
getTextColor()
Returns the text Color of this AbstractLabeledBorder's label.
|
protected Dimension |
getTextExtents(IFigure f)
Calculates and returns the size required by this border's label.
|
protected void |
invalidate()
Resets the internal values and state so that they can be recalculated.
|
void |
setFont(Font font)
Sets the Font of this border to the input value, and invalidates the
border forcing an update of internal parameters of insets and text
extents.
|
void |
setLabel(java.lang.String s)
Sets the text to be displayed as the label for this Border.
|
void |
setTextColor(Color color)
Sets the color for this border's text.
|
getPaintRectangle, isOpaque
public AbstractLabeledBorder()
public AbstractLabeledBorder(java.lang.String s)
s
- Label to be set on the borderprotected abstract Insets calculateInsets(IFigure figure)
invalidate()
is called.figure
- The figure to which the border is being appliedprotected Font getFont(IFigure f)
f
- Figure used to get a default fontpublic Insets getInsets(IFigure fig)
public java.lang.String getLabel()
LabeledBorder
getLabel
in interface LabeledBorder
LabeledBorder.getLabel()
public Dimension getPreferredSize(IFigure fig)
Border
getPreferredSize
in interface Border
getPreferredSize
in class AbstractBorder
fig
- The figureBorder.getPreferredSize(IFigure)
public Color getTextColor()
protected Dimension getTextExtents(IFigure f)
f
- IFigure on which the calculations are to be madeprotected void invalidate()
public void setFont(Font font)
setFont
in interface LabeledBorder
font
- The fontpublic void setLabel(java.lang.String s)
LabeledBorder
setLabel
in interface LabeledBorder
s
- The textLabeledBorder.setLabel(String)
public void setTextColor(Color color)
color
- Color to be set for this border's textCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.