Package jcckit.graphic
Class BasicGraphicAttributes
- java.lang.Object
-
- jcckit.graphic.ShapeAttributes
-
- jcckit.graphic.BasicGraphicAttributes
-
- All Implemented Interfaces:
FillAttributes
,GraphicAttributes
,LineAttributes
,TextAttributes
public class BasicGraphicAttributes extends ShapeAttributes implements TextAttributes
The basic attributes of anyBasicGraphicalElement
. This is an extension ofShapeAttributes
implementingTextAttributes
.- Author:
- Franz-Josef Elmer
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FONT_NAME_KEY
Configuration parameter key.static java.lang.String
FONT_SIZE_KEY
Configuration parameter key.static java.lang.String
FONT_STYLE_KEY
Configuration parameter key.static java.lang.String
HORIZONTAL_ANCHOR_KEY
Configuration parameter key.static java.lang.String
ORIENTATION_ANGLE_KEY
Configuration parameter key.static java.lang.String
TEXT_COLOR_KEY
Configuration parameter key.static java.lang.String
VERTICAL_ANCHOR_KEY
Configuration parameter key.-
Fields inherited from class jcckit.graphic.ShapeAttributes
FILL_COLOR_KEY, LINE_COLOR_KEY, LINE_PATTERN_KEY, LINE_THICKNESS_KEY
-
-
Constructor Summary
Constructors Constructor Description BasicGraphicAttributes(java.awt.Color fillColor, java.awt.Color lineColor, double lineThickness, double[] linePattern, java.awt.Color textColor, java.lang.String fontName, FontStyle fontStyle, double fontSize, double orientationAngle, Anchor horizontalAnchor, Anchor verticalAnchor)
Creates a new instance.BasicGraphicAttributes(ConfigParameters config)
Creates a new instance based on the specified configuration parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getFontName()
Returns the font name.double
getFontSize()
Returns the font size in units of the device-independent coordinates.FontStyle
getFontStyle()
Returns the font style.Anchor
getHorizontalAnchor()
Returns the anchor for horizontal position of the text.double
getOrientationAngle()
Returns the orientation angle in degree.java.awt.Color
getTextColor()
Returns the text color.Anchor
getVerticalAnchor()
Returns the anchor for vertical position of the text.-
Methods inherited from class jcckit.graphic.ShapeAttributes
getFillColor, getLineColor, getLinePattern, getLineThickness
-
-
-
-
Field Detail
-
TEXT_COLOR_KEY
public static final java.lang.String TEXT_COLOR_KEY
Configuration parameter key.- See Also:
- Constant Field Values
-
FONT_NAME_KEY
public static final java.lang.String FONT_NAME_KEY
Configuration parameter key.- See Also:
- Constant Field Values
-
FONT_STYLE_KEY
public static final java.lang.String FONT_STYLE_KEY
Configuration parameter key.- See Also:
- Constant Field Values
-
FONT_SIZE_KEY
public static final java.lang.String FONT_SIZE_KEY
Configuration parameter key.- See Also:
- Constant Field Values
-
HORIZONTAL_ANCHOR_KEY
public static final java.lang.String HORIZONTAL_ANCHOR_KEY
Configuration parameter key.- See Also:
- Constant Field Values
-
VERTICAL_ANCHOR_KEY
public static final java.lang.String VERTICAL_ANCHOR_KEY
Configuration parameter key.- See Also:
- Constant Field Values
-
ORIENTATION_ANGLE_KEY
public static final java.lang.String ORIENTATION_ANGLE_KEY
Configuration parameter key.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicGraphicAttributes
public BasicGraphicAttributes(ConfigParameters config)
Creates a new instance based on the specified configuration parameters.Key & Default Value Type Mandatory Description textColor = default foreground color of the renderer Color no The text color. fontName = default font name of the renderer String no The name of the text font. The standard Java font name "Serif", "SansSerif", and "Monospaced" can be used. Other font names depend on the actual Renderer
rendering the correspondingBasicGraphicalElement
.fontStyle = normal String no The font style. Possible values are: - normal
- bold
- italic
- bold italic
fontSize = default font size of the renderer double no The font size in units of the device-independent coordinates. orientationAngle = 0 double no The orientation angle of the text (in degree). Zero means normal orientation whereas a positive value means a rotation in counter-clockweise direction. horizontalAnchor = left String no Anchor for horizontal text position. Possible values are left, center, and right. verticalAnchor = center String no Anchor for vertical text position. Possible values are top, center, and bottom. constructor
of the superclassShapeAttributes
.
-
BasicGraphicAttributes
public BasicGraphicAttributes(java.awt.Color fillColor, java.awt.Color lineColor, double lineThickness, double[] linePattern, java.awt.Color textColor, java.lang.String fontName, FontStyle fontStyle, double fontSize, double orientationAngle, Anchor horizontalAnchor, Anchor verticalAnchor)
Creates a new instance.- Parameters:
fillColor
- The fill color. May be null.lineColor
- The line color. May be null.lineThickness
- Thickness of the line. Negative numbers will be trimmed to zero.linePattern
- Line pattern. May be null.textColor
- The text color. May be null.fontName
- The font name. May be null.fontStyle
- The font style. May be null.fontSize
- The font size in units of the device-independent coordinates. May be null.orientationAngle
- Orientation angle of the text.horizontalAnchor
- Horizontal text anchor.verticalAnchor
- Vertical text anchor.
-
-
Method Detail
-
getTextColor
public java.awt.Color getTextColor()
Returns the text color.- Specified by:
getTextColor
in interfaceTextAttributes
- Returns:
- null means default color of the renderer.
-
getFontName
public java.lang.String getFontName()
Returns the font name.- Specified by:
getFontName
in interfaceTextAttributes
- Returns:
- null means default font name of the renderer.
-
getFontStyle
public FontStyle getFontStyle()
Returns the font style.- Specified by:
getFontStyle
in interfaceTextAttributes
- Returns:
- null means default font style of the renderer.
-
getFontSize
public double getFontSize()
Returns the font size in units of the device-independent coordinates.- Specified by:
getFontSize
in interfaceTextAttributes
-
getOrientationAngle
public double getOrientationAngle()
Returns the orientation angle in degree. Zero means normal text orientation. Any positive angle means a counter-clockwise rotation of the text.- Specified by:
getOrientationAngle
in interfaceTextAttributes
-
getHorizontalAnchor
public Anchor getHorizontalAnchor()
Returns the anchor for horizontal position of the text. Note, that the anchor is related to the text before it is rotated by the orientation angle.- Specified by:
getHorizontalAnchor
in interfaceTextAttributes
- Returns:
- one of the three instances of Anchor.
-
getVerticalAnchor
public Anchor getVerticalAnchor()
Returns the anchor for vertical position of the text. Note, that the anchor is related to the text before it is rotated by the orientation angle.- Specified by:
getVerticalAnchor
in interfaceTextAttributes
- Returns:
- one of the three instances of Anchor.
-
-