Package org.biojava.bio.gui.sequence
Class CrosshairRenderer
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojava.bio.gui.sequence.CrosshairRenderer
- All Implemented Interfaces:
PairwiseSequenceRenderer
,Changeable
CrosshairRenderer
draws a crosshair, optionally
with coordinates. The crosshair is set to a sequence position by a
click and then stays there through scrolls/rescales until the next
click. See the processMouseEvent
documentation for
details of responses to various mouse actions.
- Since:
- 1.2
- Author:
- Keith James
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.bio.gui.sequence.PairwiseSequenceRenderer
PairwiseSequenceRenderer.PairwiseRendererForwarder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChangeType
ConstantOUTLINE
indicating a change to the crosshair paint.protected Point
point
is the current location (in sequence coordinates) of the crosshair in the X and Y sequences.protected Line2D
xHair
is the vertical line positioned along the X-axis.protected Line2D
yHair
is the horizontal line positioned along the Y-axis. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newCrosshairRenderer
in light grey with coordinates displayed.CrosshairRenderer
(Paint outline) Creates a newCrosshairRenderer
of the specified colour, with coordinates displayed. -
Method Summary
Modifier and TypeMethodDescriptionvoid
coordinateDisplayOn
(boolean display) coordinateDisplayOn
toggles the display of sequence coordinates.getOutline
returns the colour used to draw the lines.void
paint
(Graphics2D g2, PairwiseRenderContext context) paint
s some or all of the information about the sequence pair.processMouseEvent
(PairwiseRenderContext context, MouseEvent me, List path) processMouseEvent
processes anyMouseEvent
s directed to the renderer.void
setOutline
(Paint outline) setOutline
sets the the colour used to draw the lines.Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Field Details
-
OUTLINE
ConstantOUTLINE
indicating a change to the crosshair paint. -
xHair
xHair
is the vertical line positioned along the X-axis. -
yHair
yHair
is the horizontal line positioned along the Y-axis. -
point
point
is the current location (in sequence coordinates) of the crosshair in the X and Y sequences.
-
-
Constructor Details
-
CrosshairRenderer
public CrosshairRenderer()Creates a newCrosshairRenderer
in light grey with coordinates displayed. -
CrosshairRenderer
Creates a newCrosshairRenderer
of the specified colour, with coordinates displayed.- Parameters:
outline
- aPaint
.
-
-
Method Details
-
paint
Description copied from interface:PairwiseSequenceRenderer
paint
s some or all of the information about the sequence pair.- Specified by:
paint
in interfacePairwiseSequenceRenderer
- Parameters:
g2
- aGraphics2D
.context
- aPairwiseRenderContext
encapsulating the information to be displayed.
-
coordinateDisplayOn
coordinateDisplayOn
toggles the display of sequence coordinates.- Parameters:
display
- aboolean
.
-
getOutline
getOutline
returns the colour used to draw the lines.- Returns:
- a
Paint
.
-
setOutline
setOutline
sets the the colour used to draw the lines.- Parameters:
outline
- aPaint
.- Throws:
ChangeVetoException
- if an error occurs.
-
processMouseEvent
public SequenceViewerEvent processMouseEvent(PairwiseRenderContext context, MouseEvent me, List path) processMouseEvent
processes anyMouseEvent
s directed to the renderer.Mouse actions are as follows (all are button-1 only):
- Click sets the crosshair position and returns an event
whose target object is the
Point
in sequence coordinates. The X coordinate is in the primary sequence, the Y coordinate is in the secondary sequence. - Press same as Click
- Drag same as Click, except that the
Point
is not set - Release same as Click, except that the
Point
is not set - Move same as Click, except that the
Point
is not set and the target is null
- Specified by:
processMouseEvent
in interfacePairwiseSequenceRenderer
- Parameters:
context
- aPairwiseRenderContext
.me
- aMouseEvent
.path
- aList
.- Returns:
- a
SequenceViewerEvent
.
- Click sets the crosshair position and returns an event
whose target object is the
-