Package org.opensourcephysics.display
Class Protractor
java.lang.Object
org.opensourcephysics.display.Circle
org.opensourcephysics.display.MeasuredCircle
org.opensourcephysics.display.InteractiveCircle
org.opensourcephysics.display.Protractor
- All Implemented Interfaces:
Drawable
,Interactive
,Measurable
A Protractor with an arrow that can be used to measure angles.
- Version:
- 1.0
- Author:
- W. Christian
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.opensourcephysics.display.InteractiveCircle
InteractiveCircle.InteractiveCircleLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double
protected DecimalFormat
protected double
protected boolean
protected InteractiveLabel
protected Protractor.Tip
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a protractor with a default radius of 40 pixels.Protractor
(int protractorRadius) Constructs a protractor with the given pixel size. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the protractor on the given drawing panel.findInteractive
(DrawingPanel panel, int xpix, int ypix) double
Gets the orientation of the protractor.double
getTheta()
Gets the angle of the arrow on the protractor.boolean
Gets the show theta property.void
setOrientation
(double angle) Sets the orientation of the protractor.void
setShowTheta
(boolean show) Shows theta when the protractor is drawn when true.void
setTheta
(double angle) Sets the angle of the arrow on the protractor.Methods inherited from class org.opensourcephysics.display.InteractiveCircle
getLoader, isEnabled, isInside, setEnabled
Methods inherited from class org.opensourcephysics.display.MeasuredCircle
getXMax, getXMin, getYMax, getYMin, isMeasured, setMeasured
Methods inherited from class org.opensourcephysics.display.Circle
getX, getY, setX, setXY, setY, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
getX, getY, isInteractive, setX, setXY, setY
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
-
Field Details
-
tip
-
arrowTheta
protected double arrowTheta -
orientation
protected double orientation -
f
-
showTheta
protected boolean showTheta -
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
- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classInteractiveCircle
-
draw
Draws the protractor on the given drawing panel.
-