Class AbstractJaxoHandle
java.lang.Object
net.sf.jaxodraw.gui.handle.AbstractJaxoHandle
- All Implemented Interfaces:
JaxoHandle
- Direct Known Subclasses:
JaxoDefaultHandle, JaxoRoundHandle
An abstract class for handles.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ColorThe default color of a handle: JaxoColor.RED.static final ColorThe default fill color of a handle: JaxoColor.GRAYSCALE150.static final ColorThe default secondary color of a handle: JaxoColor.NAVY_BLUE.static final intThe default size of a handle.static final StrokeThe default stroke for a handle. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBounds(int x, int y) Return an enclosing Rectangle that completely contains this handle at the given position.final ColorgetColor()Returns the color of this handle.final ColorReturns the fill color of this handle.final ColorReturns the secondary color of this handle.final intgetSize()The handle size.final StrokeReturns the stroke of this handle.voidpaint(JaxoGraphics2D g2, int x, int y) Paints an unmarked handle at (x, y).voidpaint(JaxoGraphics2D g2, int x, int y, boolean marked) Paints a handle at (x, y).voidpaint(JaxoGraphics2D g2, int x, int y, boolean marked, boolean secondary) Paint the handle at a given position.abstract voidpaint(JaxoGraphics2D g2, int x, int y, boolean marked, Color handleColor) Paints the handle to the given graphics context.voidpaintSecondary(JaxoGraphics2D g2, int x, int y) Paints an unmarked handle in secondary color at (x, y).voidpaintSecondary(JaxoGraphics2D g2, int x, int y, boolean marked) Paints a handle in secondary color at (x, y).final voidSets the color of this handle.final voidSets the fill color of this fhandle.final voidSets the secondary color of this handle.voidsetSize(int value) Sets the handle size.final voidSets the stroke of this handle.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface JaxoHandle
contains
-
Field Details
-
DEFAULT_SIZE
public static final int DEFAULT_SIZEThe default size of a handle.- See Also:
-
DEFAULT_STROKE
The default stroke for a handle. -
DEFAULT_COLOR
The default color of a handle: JaxoColor.RED. -
DEFAULT_SECONDARY_COLOR
The default secondary color of a handle: JaxoColor.NAVY_BLUE. -
DEFAULT_FILL_COLOR
The default fill color of a handle: JaxoColor.GRAYSCALE150.
-
-
Constructor Details
-
AbstractJaxoHandle
public AbstractJaxoHandle()
-
-
Method Details
-
getColor
-
setColor
Sets the color of this handle.- Parameters:
c- The color of this handle.
-
getFillColor
Returns the fill color of this handle.- Returns:
- The fill color of this handle.
-
setFillColor
Sets the fill color of this fhandle.- Parameters:
c- The color to be set as fill color.
-
getSecondaryColor
Returns the secondary color of this handle.- Returns:
- The secondary color of this handle.
-
setSecondaryColor
Sets the secondary color of this handle.- Parameters:
c- The secondary color of this handle.
-
getSize
public final int getSize()The handle size. The exact meaning of 'size' has to be defined by the implementation.- Returns:
- The size of the handle.
-
setSize
public void setSize(int value) Sets the handle size.- Parameters:
value- The new size.
-
getStroke
Returns the stroke of this handle.- Returns:
- The stroke of this handle.
-
setStroke
Sets the stroke of this handle.- Parameters:
newStroke- The stroke property of thishandle.
-
paint
Paints an unmarked handle at (x, y).- Parameters:
g2- The graphics context to paint to.x- The x position of the handle.y- The y position of the handle.
-
paint
Paints a handle at (x, y).- Parameters:
g2- The graphics context to paint to.x- The x position of the handle.y- The y position of the handle.marked- True if the handle should be marked (selected).
-
paint
Paint the handle at a given position.- Specified by:
paintin interfaceJaxoHandle- Parameters:
g2- The graphics context to paint to.x- The x position of the handle.y- The y position of the handle.marked- True if the handle should be painted as marked. A marked handle is one that has been selected, eg for an edit operation.secondary- True if this is a secondary handle. A secondary handle is one that cannot be selected in the current context.
-
paintSecondary
Paints an unmarked handle in secondary color at (x, y).- Parameters:
g2- The graphics context to paint to.x- The x position of the handle.y- The y position of the handle.
-
paintSecondary
Paints a handle in secondary color at (x, y).- Parameters:
g2- The graphics context to paint to.x- The x position of the handle.y- The y position of the handle.marked- True if the handle should be marked (selected).
-
paint
Paints the handle to the given graphics context.- Parameters:
g2- The graphics context to paint to.x- The x position of the handle.y- The y position of the handle.marked- True if the handle should be marked (selected).handleColor- The color of the handle.
-
getBounds
Return an enclosing Rectangle that completely contains this handle at the given position. This default implementation returns a square of lengthgetSize()around the handle point.- Specified by:
getBoundsin interfaceJaxoHandle- Parameters:
x- the x position of this handle.y- the x position of this handle.- Returns:
- the bounding box of this handle.
-