org.opensourcephysics.display.axes
Class CoordinateStringBuilder

java.lang.Object
  extended by org.opensourcephysics.display.axes.CoordinateStringBuilder
Direct Known Subclasses:
CartesianCoordinateStringBuilder, PolarCoordinateStringBuilder

public abstract class CoordinateStringBuilder
extends java.lang.Object

Builds a coordinate string from a mouse event for an axis type.


Field Summary
protected  java.text.DecimalFormat decimalFormat
           
protected  java.text.DecimalFormat scientificFormat
           
protected  java.lang.String xLabel
           
protected  java.lang.String yLabel
           
 
Constructor Summary
CoordinateStringBuilder()
           
 
Method Summary
static CoordinateStringBuilder createCartesian()
          Creates the default builder for cartesian coordiantes.
static CoordinateStringBuilder createPolar()
          Creates the default builder for polar coordinates.
static CoordinateStringBuilder createPolar(java.lang.String rLabel, java.lang.String phiLabel, double phiOffset)
          Creates the default builder for polar coordinates.
abstract  java.lang.String getCoordinateString(DrawingPanel panel, java.awt.event.MouseEvent e)
          Converts a the pixel coordinates in a mouse event into world coordinates and return these coordinates in a string.
 void setCoordinateLabels(java.lang.String xLabel, java.lang.String yLabel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scientificFormat

protected java.text.DecimalFormat scientificFormat

decimalFormat

protected java.text.DecimalFormat decimalFormat

xLabel

protected java.lang.String xLabel

yLabel

protected java.lang.String yLabel
Constructor Detail

CoordinateStringBuilder

public CoordinateStringBuilder()
Method Detail

setCoordinateLabels

public void setCoordinateLabels(java.lang.String xLabel,
                                java.lang.String yLabel)

getCoordinateString

public abstract java.lang.String getCoordinateString(DrawingPanel panel,
                                                     java.awt.event.MouseEvent e)
Converts a the pixel coordinates in a mouse event into world coordinates and return these coordinates in a string.

Parameters:
e - the mouse event
Returns:
the coordinate string

createCartesian

public static CoordinateStringBuilder createCartesian()
Creates the default builder for cartesian coordiantes.

Returns:
CoordinateStringBuilder

createPolar

public static CoordinateStringBuilder createPolar()
Creates the default builder for polar coordinates.

Returns:
CoordinateStringBuilder

createPolar

public static CoordinateStringBuilder createPolar(java.lang.String rLabel,
                                                  java.lang.String phiLabel,
                                                  double phiOffset)
Creates the default builder for polar coordinates.

Parameters:
rLabel - String
phiLabel - String
phiOffset - double
Returns:
CoordinateStringBuilder