public class SymbolIcon extends java.lang.Object implements javax.swing.Icon, SymbolConstants
Modifier and Type | Field and Description |
---|---|
protected static java.awt.Font |
symFontBold |
protected static java.awt.Font |
symFontPlain |
CIRCLE_SYMBOL_OBJECT, RECTANGLE_SYMBOL_OBJECT, TRIANGLE_SYMBOL_OBJECT
Constructor and Description |
---|
SymbolIcon() |
Modifier and Type | Method and Description |
---|---|
void |
clearSymbolChar()
Clears any character symbol in use, making a circle symbol be used instead.
|
protected static java.awt.Polygon |
createTriangle(int x,
int y,
int width)
Creates a triangle.
|
int |
getIconHeight()
Returns the icon's height.
|
int |
getIconWidth()
Returns the icon's width.
|
java.lang.String |
getLabelText()
Get the label text.
|
boolean |
isCharSymbol()
Gets a flag indicating whether or not a character symbol is in use.
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Draw the icon at the specified location.
|
protected void |
paintSymbol(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
boolean fillFlag)
Paints the symbol.
|
void |
setBoldFlag(boolean flgVal)
Sets whether or not the the character symbol is displayed using a bold
font.
|
java.awt.Color |
setColorObj(java.awt.Color colorObj)
Sets the color for the symbol.
|
java.awt.Color |
setColorObj(int colorRGB)
Sets the color for the symbol.
|
void |
setFillFlag(boolean flgVal)
Sets whether or not the the object symbol is filled.
|
void |
setLabelText(java.lang.String labelText)
Set the label text.
|
void |
setOutlineColorObj(java.awt.Color colorObj)
Sets the outline color to be used for filled symbols.
|
void |
setSymbolChar(char symbolChar)
Sets the character symbol to be used.
|
void |
setSymbolObject(int symbolObj)
Sets the object symbol to be used.
|
protected void |
setupSymbol(java.awt.Graphics g)
Setup the symbol if needed.
|
protected java.lang.String |
symbolCharToString(char symbolChar)
Converts the given symbol character to a displayable, single-character
string.
|
java.lang.String |
toString()
Return the label text.
|
protected static final java.awt.Font symFontBold
protected static final java.awt.Font symFontPlain
public void clearSymbolChar()
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public java.lang.String getLabelText()
public boolean isCharSymbol()
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
c
- the component to which the icon is added.g
- graphics object to use.x
- the X coordinate of the icon's top-left corner.y
- the Y coordinate of the icon's top-left corner.fillFlag
- true if the circle is to be filled; false if not.protected void paintSymbol(java.awt.Component c, java.awt.Graphics g, int x, int y, boolean fillFlag)
g
- graphics object to use.c
- the component to which the icon is added.x
- the X coordinate of the icon's top-left corner.y
- the Y coordinate of the icon's top-left corner.fillFlag
- true if the circle is to be filled; false if not.public void setBoldFlag(boolean flgVal)
flgVal
- true for bold, false for normal font.public java.awt.Color setColorObj(java.awt.Color colorObj)
colorObj
- the color to use.public java.awt.Color setColorObj(int colorRGB)
colorRGB
- the color RGB to use.public void setFillFlag(boolean flgVal)
flgVal
- true if the object is to be filled; false if not.public void setLabelText(java.lang.String labelText)
labelText
- the label text.public void setOutlineColorObj(java.awt.Color colorObj)
colorObj
- the color for the symbol outline, or null for no outline.public void setSymbolChar(char symbolChar)
symbolChar
- the character symbol to use, or '(char)0' to have no
character symbol (and use circle symbol instead).public void setSymbolObject(int symbolObj)
symbolObj
- the object symbol to use.protected void setupSymbol(java.awt.Graphics g)
g
- graphics object to use.protected java.lang.String symbolCharToString(char symbolChar)
symbolChar
- the character to use.public java.lang.String toString()
toString
in class java.lang.Object
protected static java.awt.Polygon createTriangle(int x, int y, int width)
x
- the x coordinate of the triangle to be drawn.y
- the y coordinate of the triangle to be drawn.width
- the width of the triangle to be drawn.