Class Protractor

All Implemented Interfaces:
Drawable, Interactive, Measurable

public class Protractor extends InteractiveCircle implements Drawable
A Protractor with an arrow that can be used to measure angles.
Version:
1.0
Author:
W. Christian
  • Field Details

    • tip

      protected Protractor.Tip tip
    • arrowTheta

      protected double arrowTheta
    • orientation

      protected double orientation
    • f

      protected DecimalFormat f
    • showTheta

      protected boolean showTheta
    • tauBox

      protected InteractiveLabel tauBox
  • Constructor Details

    • Protractor

      public Protractor(int protractorRadius)
      Constructs a protractor with the given pixel size.
      Parameters:
      protractorRadius - int
    • Protractor

      public Protractor()
      Constructs a protractor with a default radius of 40 pixels.
  • Method Details

    • setTheta

      public void setTheta(double angle)
      Sets the angle of the arrow on the protractor.
      Parameters:
      theta - double
    • getTheta

      public double getTheta()
      Gets the angle of the arrow on the protractor.
      Returns:
      double
    • setOrientation

      public void setOrientation(double angle)
      Sets the orientation of the protractor.
      Parameters:
      angle - double
    • getOrientation

      public double getOrientation()
      Gets the orientation of the protractor.
      Returns:
      double
    • setShowTheta

      public void setShowTheta(boolean show)
      Shows theta when the protractor is drawn when true.
      Parameters:
      show - boolean
    • isShowTheta

      public boolean isShowTheta()
      Gets the show theta property.
      Returns:
      boolean
    • findInteractive

      public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
      Specified by:
      findInteractive in interface Interactive
      Overrides:
      findInteractive in class InteractiveCircle
    • draw

      public void draw(DrawingPanel panel, Graphics g)
      Draws the protractor on the given drawing panel.
      Specified by:
      draw in interface Drawable
      Overrides:
      draw in class Circle
      Parameters:
      panel - DrawingPanel
      g - Graphics