public class CrosshairLayer extends AbstractSystemLayer implements MouseMotionListener, MouseWheelListener, MouseListener
ICrosshairPolicy
, which returns labels that are shown in the four
corners of the crosshair.alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE
Constructor and Description |
---|
CrosshairLayer(LayerContainer lc)
Constructs a new crosshair layer.
|
Modifier and Type | Method and Description |
---|---|
int |
getCircleRadius()
Returns the radius / size used for drawing the crosshair circle.
|
Color |
getFillColor()
Returns the color that will be used to fill out the crosshair circle.
|
Color |
getLineColor()
Returns the color used to draw the horizontal and vertical crosshair
lines.
|
BasicStroke |
getStroke()
Returns the stroke used to draw the crosshair lines.
|
Color |
getTextColor()
Returns the color used to draw the text in the four corners of the
crosshair.
|
boolean |
isHorizontalLineVisible()
Determines whether the horizontal line will be drawn.
|
boolean |
isVerticalLineVisible()
Determines whether the vertical line will be drawn.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
mouseWheelMoved(MouseWheelEvent e) |
protected void |
paintLayer(Graphics g) |
void |
setCircleRadius(int radius)
Sets the radius / size for drawing the crosshair circle.
|
void |
setFillColor(Color color)
Sets the color that will be used to fill out the crosshair circle.
|
void |
setHorizontalLineVisible(boolean visible)
Specifies whether the horizontal crosshair line will be drawn or not.
|
void |
setLineColor(Color color)
Sets the color used to draw the vertical and horizontal crosshair lines.
|
void |
setStroke(BasicStroke stroke)
Sets the stroke used to draw the crosshair lines.
|
void |
setTextColor(Color color)
Sets the color used to draw the text in the four corners of the
crosshair.
|
void |
setVerticalLineVisible(boolean visible)
Specifies whether the vertical crosshair line will be drawn or not.
|
void |
setVisible(boolean visible)
Overriden to add / remove mouse listeners to / from the layer container.
|
addPropertyChangeListener, getAlpha, getDateline, getEventline, getGanttChart, getHeight, getLayerContainer, getLayerPolicyProvider, getModel, getName, getStartRow, getTimeAt, getTimeline, getTimeLocation, getTimeSpanUsed, getToolTipText, getTreeTable, getTreeTablePolicyProvider, getWidth, isVisible, removePropertyChangeListener, repaint, repaint, repaint, setAlpha, tearDown
public CrosshairLayer(LayerContainer lc)
lc
- the layer container to which the layer belongspublic void setVisible(boolean visible)
setVisible
in class AbstractLayer
visible
- if TRUE the layer will be visibleAbstractLayer.isVisible()
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
protected void paintLayer(Graphics g)
paintLayer
in class AbstractLayer
public BasicStroke getStroke()
public void setStroke(BasicStroke stroke)
stroke
- the stroke used for drawing the crosshair linespublic boolean isHorizontalLineVisible()
public void setHorizontalLineVisible(boolean visible)
visible
- if TRUE the horizontal line will be drawnpublic boolean isVerticalLineVisible()
public void setVerticalLineVisible(boolean visible)
visible
- if TRUE the vertical line will be drawnpublic void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public int getCircleRadius()
public void setCircleRadius(int radius)
radius
- the size of the crosshair circlepublic Color getFillColor()
public void setFillColor(Color color)
color
- the crosshair circle fill colorpublic Color getLineColor()
public void setLineColor(Color color)
color
- the crosshair line colorpublic Color getTextColor()
public void setTextColor(Color color)
color
- the crosshair text colorCopyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.