Package kiyut.sketsa.canvas.tool
Class PolyTool
- java.lang.Object
-
- kiyut.sketsa.canvas.tool.AbstractTool
-
- kiyut.sketsa.canvas.tool.PolyTool
-
- All Implemented Interfaces:
KeyListener,MouseListener,MouseMotionListener,EventListener,MouseInputListener,Tool
public class PolyTool extends AbstractTool
Implementation of Poly Tool- Author:
- Kiyut
-
-
Field Summary
Fields Modifier and Type Field Description protected Rectangle2Dboundsprotected VectorCanvascanvasprotected PaintfillPaintprotected Line2Dlineprotected Strokestrokeprotected PaintstrokePaintprotected floatstrokeWidth
-
Constructor Summary
Constructors Constructor Description PolyTool()Creates a new instance of PolyTool
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.w3c.dom.svg.SVGElementcreateSVGElement()voidendTool()Invoked when the tool is endedvoidmouseClicked(MouseEvent evt)voidmouseDragged(MouseEvent evt)voidmousePressed(MouseEvent evt)voidmouseReleased(MouseEvent evt)voidpaint(Graphics2D g2d)Invoked by canvas to draw tool.voidsetFillPaint(Paint fillPaint)voidsetStroke(Stroke stroke)voidsetStrokePaint(Paint strokePaint)voidsetVectorCanvas(VectorCanvas canvas)set the canvas for the toolvoidstartTool()Invoked when the tool is started-
Methods inherited from class kiyut.sketsa.canvas.tool.AbstractTool
addMessageListener, fireMessageReceived, keyPressed, keyReleased, keyTyped, mouseEntered, mouseExited, mouseMoved, removeMessageListener
-
-
-
-
Field Detail
-
canvas
protected VectorCanvas canvas
-
line
protected Line2D line
-
bounds
protected Rectangle2D bounds
-
strokePaint
protected Paint strokePaint
-
fillPaint
protected Paint fillPaint
-
stroke
protected Stroke stroke
-
strokeWidth
protected float strokeWidth
-
-
Method Detail
-
paint
public void paint(Graphics2D g2d)
Description copied from interface:ToolInvoked by canvas to draw tool.- Specified by:
paintin interfaceTool- Overrides:
paintin classAbstractTool- Parameters:
g2d- the Graphics2D context in which to paint
-
setVectorCanvas
public void setVectorCanvas(VectorCanvas canvas)
Description copied from interface:Toolset the canvas for the tool- Specified by:
setVectorCanvasin interfaceTool- Overrides:
setVectorCanvasin classAbstractTool- Parameters:
canvas- VectorCanvas
-
setStrokePaint
public void setStrokePaint(Paint strokePaint)
-
setFillPaint
public void setFillPaint(Paint fillPaint)
-
setStroke
public void setStroke(Stroke stroke)
-
endTool
public void endTool()
Description copied from interface:ToolInvoked when the tool is ended- Specified by:
endToolin interfaceTool- Overrides:
endToolin classAbstractTool
-
startTool
public void startTool()
Description copied from interface:ToolInvoked when the tool is started- Specified by:
startToolin interfaceTool- Overrides:
startToolin classAbstractTool
-
mouseDragged
public void mouseDragged(MouseEvent evt)
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classAbstractTool
-
mouseClicked
public void mouseClicked(MouseEvent evt)
- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classAbstractTool
-
mousePressed
public void mousePressed(MouseEvent evt)
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classAbstractTool
-
mouseReleased
public void mouseReleased(MouseEvent evt)
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classAbstractTool
-
createSVGElement
protected org.w3c.dom.svg.SVGElement createSVGElement()
-
-