Class PolygonTool

All Implemented Interfaces:
RMArchiver.Archiving, Cloneable
Direct Known Subclasses:
PolygonTool.PencilTool

public class PolygonTool extends Tool
This class manages creation and editing of polygon shapes.
  • Constructor Details

    • PolygonTool

      public PolygonTool()
  • Method Details

    • getShapeClass

      public Class getShapeClass()
      Returns the class that this tool is responsible for.
      Overrides:
      getShapeClass in class Tool
    • newInstance

      public RMShape newInstance()
      Returns a new instance of the shape class that this tool is responsible for.
      Overrides:
      newInstance in class Tool
    • getSmoothPathOnMouseUp

      public boolean getSmoothPathOnMouseUp()
      Returns whether tool should smooth path segments during creation.
    • mousePressed

      public void mousePressed(MouseEvent anEvent)
      Handles mouse pressed for polygon creation.
      Overrides:
      mousePressed in class Tool
    • mouseDragged

      public void mouseDragged(MouseEvent anEvent)
      Handles mouse dragged for polygon creation.
      Overrides:
      mouseDragged in class Tool
    • mouseReleased

      public void mouseReleased(MouseEvent anEvent)
      Handles mouse released for polygon creation.
      Overrides:
      mouseReleased in class Tool
    • mouseMoved

      public void mouseMoved(RMShape aShape, MouseEvent anEvent)
      Event handling - overridden to maintain default cursor.
      Overrides:
      mouseMoved in class Tool
    • mousePressed

      public void mousePressed(RMShape aShape, MouseEvent anEvent)
      Event handling for shape editing.
      Overrides:
      mousePressed in class Tool
    • mouseDragged

      public void mouseDragged(RMShape aShape, MouseEvent anEvent)
      Event handling for shape editing.
      Overrides:
      mouseDragged in class Tool
    • deactivateTool

      public void deactivateTool()
      Overrides standard tool method to trigger polygon creation when the tool is deactivated.
      Overrides:
      deactivateTool in class Tool
    • reactivateTool

      public void reactivateTool()
      Overrides standard tool method to trigger polygon creation when the tool is reactivated.
      Overrides:
      reactivateTool in class Tool
    • paintTool

      public void paintTool(Graphics2D g)
      Draws the polygon tool's path durring path creation.
      Overrides:
      paintTool in class Tool