Class Text
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.watermark.AbstractWatermark
-
- adams.gui.visualization.watermark.Text
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Watermark
,Serializable
public class Text extends AbstractWatermark
Displays the supplied text.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_Alpha
the alpha value to use for the overlay (0: transparent, 255: opaque).protected boolean
m_AntiAliasingEnabled
whether anti-aliasing is enabled.protected Color
m_Color
the color of the pixel.protected Font
m_Font
the font to use.protected Location
m_Location
the location.protected int
m_Padding
the padding to use.protected BaseText
m_Text
the text to draw.protected int
m_X
the X position of the text (1-based).protected int
m_Y
the Y position of the text (1-based).protected int
m_YIncrement
the Y increment when outputting multiple lines.-
Fields inherited from class adams.gui.visualization.watermark.AbstractWatermark
m_Enabled
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Text()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
alphaTipText()
Returns the tip text for this property.String
antiAliasingEnabledTipText()
Returns the tip text for this property.protected boolean
canApplyWatermark(Graphics g, Dimension dimension)
Returns whether the watermark can be applied.String
colorTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected void
doApplyWatermark(Graphics g, Dimension dimension)
Applies the watermark in the specified graphics context.String
fontTipText()
Returns the tip text for this property.int
getAlpha()
Returns the alpha value to use for the overlay: 0=transparent, 255=opaque.Color
getColor()
Returns the color of the pixel.protected Location
getDefaultLocation()
Returns the default location.protected int
getDefaultPadding()
Returns the default padding around the image.Font
getFont()
Returns the font in use.Location
getLocation()
Returns the location of the image.int
getPadding()
Returns the padding around the image.BaseText
getText()
Returns the text to draw.int
getX()
Returns the X position of the text (top-left corner).int
getY()
Returns the Y position of the text (top-left corner).int
getYIncrement()
Returns the Y increment when outputting multiple lines.String
globalInfo()
Returns a string describing the object.boolean
isAntiAliasingEnabled()
Returns whether anti-aliasing is used.String
locationTipText()
Returns the tip text for this property.String
paddingTipText()
Returns the tip text for this property.void
setAlpha(int value)
Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.void
setAntiAliasingEnabled(boolean value)
Sets whether to use anti-aliasing.void
setColor(Color value)
Sets the color of the pixel.void
setFont(Font value)
Sets the font to use.void
setLocation(Location value)
Sets the location of the image.void
setPadding(int value)
Sets the padding around the image.void
setText(BaseText value)
Sets the text to draw.void
setX(int value)
Sets the X position of the text (top-left corner).void
setY(int value)
Sets the Y position of the text (top-left corner).void
setYIncrement(int value)
Sets the Y increment when outputting multiple lines.String
textTipText()
Returns the tip text for this property.String
XTipText()
Returns the tip text for this property.String
YIncrementTipText()
Returns the tip text for this property.String
YTipText()
Returns the tip text for this property.-
Methods inherited from class adams.gui.visualization.watermark.AbstractWatermark
applyWatermark, enabledTipText, getEnabled, setEnabled
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Location
protected Location m_Location
the location.
-
m_X
protected int m_X
the X position of the text (1-based).
-
m_Y
protected int m_Y
the Y position of the text (1-based).
-
m_Padding
protected int m_Padding
the padding to use.
-
m_YIncrement
protected int m_YIncrement
the Y increment when outputting multiple lines.
-
m_Color
protected Color m_Color
the color of the pixel.
-
m_Font
protected Font m_Font
the font to use.
-
m_AntiAliasingEnabled
protected boolean m_AntiAliasingEnabled
whether anti-aliasing is enabled.
-
m_Alpha
protected int m_Alpha
the alpha value to use for the overlay (0: transparent, 255: opaque).
-
m_Text
protected BaseText m_Text
the text to draw.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractWatermark
-
getDefaultLocation
protected Location getDefaultLocation()
Returns the default location.- Returns:
- the default
-
setLocation
public void setLocation(Location value)
Sets the location of the image.- Parameters:
value
- the location
-
getLocation
public Location getLocation()
Returns the location of the image.- Returns:
- the location
-
locationTipText
public String locationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setX
public void setX(int value)
Sets the X position of the text (top-left corner).- Parameters:
value
- the position, 1-based
-
getX
public int getX()
Returns the X position of the text (top-left corner).- Returns:
- the position, 1-based
-
XTipText
public String XTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setY
public void setY(int value)
Sets the Y position of the text (top-left corner).- Parameters:
value
- the position, 1-based
-
getY
public int getY()
Returns the Y position of the text (top-left corner).- Returns:
- the position, 1-based
-
YTipText
public String YTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultPadding
protected int getDefaultPadding()
Returns the default padding around the image.- Returns:
- the default
-
setPadding
public void setPadding(int value)
Sets the padding around the image.- Parameters:
value
- the padding
-
getPadding
public int getPadding()
Returns the padding around the image.- Returns:
- the padding
-
paddingTipText
public String paddingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setYIncrement
public void setYIncrement(int value)
Sets the Y increment when outputting multiple lines.- Parameters:
value
- the increment, -1 for autodetection based on font
-
getYIncrement
public int getYIncrement()
Returns the Y increment when outputting multiple lines.- Returns:
- the increment, -1 for autodetection based on font
-
YIncrementTipText
public String YIncrementTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColor
public void setColor(Color value)
Sets the color of the pixel.- Parameters:
value
- the color
-
getColor
public Color getColor()
Returns the color of the pixel.- Returns:
- the color
-
colorTipText
public String colorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFont
public void setFont(Font value)
Sets the font to use.- Parameters:
value
- the font
-
getFont
public Font getFont()
Returns the font in use.- Returns:
- the font
-
fontTipText
public String fontTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setText
public void setText(BaseText value)
Sets the text to draw.- Parameters:
value
- the text
-
getText
public BaseText getText()
Returns the text to draw.- Returns:
- the text
-
textTipText
public String textTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAntiAliasingEnabled
public void setAntiAliasingEnabled(boolean value)
Sets whether to use anti-aliasing.- Parameters:
value
- if true then anti-aliasing is used
-
isAntiAliasingEnabled
public boolean isAntiAliasingEnabled()
Returns whether anti-aliasing is used.- Returns:
- true if anti-aliasing is used
-
antiAliasingEnabledTipText
public String antiAliasingEnabledTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAlpha
public void setAlpha(int value)
Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.- Parameters:
value
- the alpha value
-
getAlpha
public int getAlpha()
Returns the alpha value to use for the overlay: 0=transparent, 255=opaque.- Returns:
- the alpha value
-
alphaTipText
public String alphaTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
canApplyWatermark
protected boolean canApplyWatermark(Graphics g, Dimension dimension)
Returns whether the watermark can be applied.- Overrides:
canApplyWatermark
in classAbstractWatermark
- Parameters:
g
- the graphics contextdimension
- the dimension of the drawing area- Returns:
- true if it can be applied
-
doApplyWatermark
protected void doApplyWatermark(Graphics g, Dimension dimension)
Applies the watermark in the specified graphics context.- Specified by:
doApplyWatermark
in classAbstractWatermark
- Parameters:
g
- the graphics contextdimension
- the dimension of the drawing area
-
-