public class CrossHairTool extends Tool implements ModifierActivated
Tool.ActivationRequest
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
CrossHairTool()
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
getActivationModifiers()
Returns the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.)
to be used to change the frozen state.
|
Color |
getColor() |
FrozenMode |
getFrozenMode()
Returns the current frozen mode behaviour.
|
int |
getLineWidth() |
protected int |
getRenderPriority()
Return the render priority for this tool.
|
protected void |
handleMouseClicked(MouseEditEvent e,
boolean isActive)
Invoked when the mouse button has been clicked (pressed and released) on a component.
|
protected void |
handleMouseMoved(MouseEditEvent e,
boolean isActive)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
|
protected void |
handleMousePressed(MouseEditEvent e,
boolean isActive)
Invoked when a mouse button has been pressed on a component.
|
protected void |
handleMouseReleased(MouseEditEvent e,
boolean isActive)
Invoked when a mouse button has been released on a component.
|
boolean |
isFrozen()
Gets the frozen state.
|
protected void |
render(RenderParameters parameters,
boolean isActive)
Renders the Tool's UI onto the given
Graphics2D context using the given
RenderControls . |
void |
setActivationModifiers(int activationModifiers)
Set the mask of modifier keys (Shift, Control, Alt etc.) and mouse buttons (left, right etc.) to
be used to change the frozen state.
|
void |
setColor(Color color)
Changes the line color
|
void |
setFrozen(boolean frozen)
Sets / unsets the frozen state where the pane will remain in focus of the last point before being
set to frozen.
|
void |
setFrozenMode(FrozenMode frozenMode)
Changes the frozen mode behaviour.
|
void |
setLineWidth(int lineWidth) |
protected void |
setManager(ToolManager manager)
Receives the
ToolManager instance, which the Tool implementation has been
registered for. |
contribute, getActivationFeedback, getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getCursor, getDispatchPriority, getManager, handleEditEvent, handleKeyPressed, handleKeyReleased, handleKeyTyped, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseWheelMoved, propagatePropertyChange, setActive, setCursor, setEnabled, setStatusFeedback
protected int getRenderPriority()
Tool
Tool.MIN_PRIORITY
...Tool.MAX_PRIORITY
.
The default priority is equal to Tool.DEFAULT_PRIORITY
.getRenderPriority
in class Tool
protected void render(RenderParameters parameters, boolean isActive)
Tool
Graphics2D
context using the given
RenderControls
.
This render method is called within the context and during the rendering of a single page. The page being rendered is passed to implementors of this method in order to be able to control and influence the page rendering.
public Color getColor()
public void setColor(Color color)
public int getLineWidth()
public void setLineWidth(int lineWidth)
public boolean isFrozen()
true
if the pane is in frozen state; false
otherwisepublic void setFrozen(boolean frozen)
frozen
- the frozen flag to be setprotected void handleMouseClicked(MouseEditEvent e, boolean isActive)
Tool
handleMouseClicked
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseMoved(MouseEditEvent e, boolean isActive)
Tool
handleMouseMoved
in class Tool
isActive
- whether this tool is currently activeprotected void handleMousePressed(MouseEditEvent e, boolean isActive)
Tool
handleMousePressed
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseReleased(MouseEditEvent e, boolean isActive)
Tool
handleMouseReleased
in class Tool
isActive
- whether this tool is currently activeprotected void setManager(ToolManager manager)
Tool
ToolManager
instance, which the Tool
implementation has been
registered for. If the Tool
is deregistered
this
method will be called with null.setManager
in class Tool
public FrozenMode getFrozenMode()
FrozenMode
public void setFrozenMode(FrozenMode frozenMode)
frozenMode
- the new mode to change toIllegalArgumentException
- the given frozen mode to change to must not be
null
.public int getActivationModifiers()
getActivationModifiers
in interface ModifierActivated
setActivationModifiers(int)
,
setFrozen(boolean)
,
isFrozen()
public void setActivationModifiers(int activationModifiers)
InputEvent.getModifiersEx()
, i.e. it must use the InputEvent
constants containing
_DOWN_
in their name.setActivationModifiers
in interface ModifierActivated
InputEvent.ALT_DOWN_MASK
,
InputEvent.ALT_GRAPH_DOWN_MASK
,
InputEvent.CTRL_DOWN_MASK
,
InputEvent.SHIFT_DOWN_MASK
,
InputEvent.BUTTON1_DOWN_MASK
,
InputEvent.BUTTON2_DOWN_MASK
,
InputEvent.BUTTON3_DOWN_MASK
,
setFrozen(boolean)
,
isFrozen()
Copyright © 2024 levigo holding gmbh. All rights reserved.