Package adams.gui.visualization.core
Class CrossHairTracker
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<Paintlet>
,SizeOfHandler
,MouseMovementTracker
,Paintlet
,Serializable
public class CrossHairTracker extends AbstractStrokePaintlet implements MouseMovementTracker
A cross-hair mouse movement tracker.
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-stroke-thickness <float> (property: strokeThickness) The thickness of the stroke. default: 1.0 minimum: 0.01
-color <java.awt.Color> (property: color) The color to use for the cross-hair. default: #ff0000
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Color
m_Color
the color of the cross-hair.protected boolean
m_TextCoordinates
whether to draw the coordinates as well.-
Fields inherited from class adams.gui.visualization.core.AbstractStrokePaintlet
m_StrokeThickness
-
Fields inherited from class adams.gui.visualization.core.AbstractPaintlet
m_Enabled, m_Initializing, m_Panel, m_RepaintOnChange
-
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 CrossHairTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
colorTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected void
doPerformPaint(Graphics g, PaintEvent.PaintMoment moment)
The paint routine of the paintlet.Color
getColor()
Returns the color in use for the cross-hair.PaintEvent.PaintMoment
getPaintMoment()
Returns when this paintlet is to be executed.boolean
getTextCoordinates()
Returns whether to display the coordinates as text as well.String
globalInfo()
Returns a string describing the object.void
mouseMovementTracked(MouseEvent e)
Gets triggered when the mouse moved.void
setColor(Color value)
Sets the color to use for the cross-hair.void
setTextCoordinates(boolean value)
Sets whether to display the coordinates as text as well.MouseMovementTracker
shallowCopyTracker()
Returns a shallow copy of the tracker.MouseMovementTracker
shallowCopyTracker(boolean expand)
Returns a shallow copy of the tracker.String
textCoordinatesTipText()
Returns the tip text for this property.-
Methods inherited from class adams.gui.visualization.core.AbstractStrokePaintlet
applyStroke, getStrokeThickness, getStrokeWidth, performPaint, setStrokeThickness, strokeThicknessTipText
-
Methods inherited from class adams.gui.visualization.core.AbstractPaintlet
canPaint, finishInit, forCommandLine, forName, getPaintlets, getPanel, getPlot, getRepaintOnChange, hasPanel, initialize, isEnabled, isInitializing, memberChanged, memberChanged, paint, repaint, setEnabled, setPanel, setPanel, setRepaintOnChange, shallowCopy, shallowCopy, updatePanel
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, getDefaultLoggingLevel, getOptionManager, 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
-
Methods inherited from interface adams.gui.visualization.core.MouseMovementTracker
getPanel, setPanel
-
-
-
-
Field Detail
-
m_Color
protected Color m_Color
the color of the cross-hair.
-
m_TextCoordinates
protected boolean m_TextCoordinates
whether to draw the coordinates as well.
-
-
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 classAbstractStrokePaintlet
-
setColor
public void setColor(Color value)
Sets the color to use for the cross-hair.- Parameters:
value
- the color
-
getColor
public Color getColor()
Returns the color in use for the cross-hair.- 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.
-
setTextCoordinates
public void setTextCoordinates(boolean value)
Sets whether to display the coordinates as text as well.- Parameters:
value
- true if to display
-
getTextCoordinates
public boolean getTextCoordinates()
Returns whether to display the coordinates as text as well.- Returns:
- true if to display
-
textCoordinatesTipText
public String textCoordinatesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getPaintMoment
public PaintEvent.PaintMoment getPaintMoment()
Returns when this paintlet is to be executed.- Specified by:
getPaintMoment
in interfacePaintlet
- Specified by:
getPaintMoment
in classAbstractPaintlet
- Returns:
- when this paintlet is to be executed
-
doPerformPaint
protected void doPerformPaint(Graphics g, PaintEvent.PaintMoment moment)
The paint routine of the paintlet.- Specified by:
doPerformPaint
in classAbstractStrokePaintlet
- Parameters:
g
- the graphics context to use for paintingmoment
- whatPaintEvent.PaintMoment
is currently being painted
-
mouseMovementTracked
public void mouseMovementTracked(MouseEvent e)
Gets triggered when the mouse moved.- Specified by:
mouseMovementTracked
in interfaceMouseMovementTracker
- Parameters:
e
- the mouse event that triggered the event
-
shallowCopyTracker
public MouseMovementTracker shallowCopyTracker()
Returns a shallow copy of the tracker. Doesn't expand variables in case ofOptionHandler
objects.- Specified by:
shallowCopyTracker
in interfaceMouseMovementTracker
- Returns:
- a shallow copy of the tracker
-
shallowCopyTracker
public MouseMovementTracker shallowCopyTracker(boolean expand)
Returns a shallow copy of the tracker.- Specified by:
shallowCopyTracker
in interfaceMouseMovementTracker
- Parameters:
expand
- whether to expand variables to their actual value- Returns:
- a shallow copy of the tracker
-
-