jhplot.jadraw
Class JaText

java.lang.Object
  extended by jhplot.jadraw.JaObject
      extended by jhplot.jadraw.JaText
All Implemented Interfaces:
Serializable

public class JaText
extends JaObject

Defines a JaObject which is a postscript text. Also handles sub- and superscripts, as well as a set of greek characters via a syntax that is derived from LaTeX.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jhplot.jadraw.JaObject
BB_MAX_X, BB_MAX_Y, BB_MIN_X, BB_MIN_Y, COPY, D_FORMAT, INIT_SIZE, LENGTH, MOVE, RESIZE, SELECT_BODY, SELECT_LL, SELECT_LR, SELECT_NONE, SELECT_P1, SELECT_P2, SELECT_P3, SELECT_UL, SELECT_UR
 
Constructor Summary
JaText()
          Constructor: sets the width, height, relative width and height to a default value of 2.
JaText(String text, double x1, double y1, String what)
          Build a text label
 
Method Summary
 JaObject copy()
          Returns an exact copy of this label.
 void drawHandles(org.freehep.graphics2d.VectorGraphics g2)
          Draws the handles of this text object.
 boolean editPanel()
          Brings up the edit panel that allows to change the parameters of this object.
 Font getFont()
          Returns the textFont property of this text object.
 int getGrabbedHandle(int clickX, int clickY, int editmode)
          Determines where on this JaObject a mouse click has ocurred.
 int getPadX()
          Get pad ID in X
 int getPadY()
          Get pad ID in Y
 int getRotAngle()
          Returns the rotAngle property of this text object.
 String getText()
          Returns the textString property of this text object.
 int getType()
          Get identification type for this label
 boolean isCopy(JaObject comp)
          Returns true if all serializable variables of this JaObject and those of the specified one are equal.
 void jaxoDraw(org.freehep.graphics2d.VectorGraphics g2, boolean drawToScreen)
          The method that draws this label.
 String latexCommand(float scale, Dimension canvasDim)
          The LaTeX command that is necessary to draw the given label using the axodraw.sty package.
 String latexWidth()
          Returns the line width of this label.
 void print()
           
 void rescaleObject(int orx, int ory, float scale)
          Rescales this label by the scale factor scale, keeping the point (orx, ory) fixed.
 void setAvailableFonts(String[] fonts)
          Sets the string array of available fonts.
 void setFont(Font font)
          Sets the textFont property of this text object.
 void setPadX(int pad)
          Set pad ID in X
 void setPadY(int pad)
          Set pad ID in Y
 void setRotAngle(int angle)
          Sets the rotAngle property of this text object.
 void setText(String string)
          Sets the textString property of this text object.
 void setType(int type)
          Set identification type for this text label
 
Methods inherited from class jhplot.jadraw.JaObject
drawVisualAid, getBoundingBox, getColor, getGeneralPath, getHeight, getRelh, getRelHndc, getRelHuser, getRelSize, getRelw, getRelWndc, getRelWuser, getSize, getWidth, getX, getXndc, getXuser, getY, getYndc, getYuser, isMarked, isUser, moveBy, scalePoint, setAsMarked, setBoundingBox, setColor, setLocation, setLocation, setRelh, setRelw, setRelWAndH, setRelWH, setSize, setX, setY, updateCoor, updateNDC
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaText

public JaText()
Constructor: sets the width, height, relative width and height to a default value of 2.


JaText

public JaText(String text,
              double x1,
              double y1,
              String what)
Build a text label

Parameters:
text - text
x1 - starting x
y1 - starting y
what - if "NDC", coordinate in NDC (from 0 to 1), if "USER" coordinates are in the user system given by the axes.
Method Detail

setType

public void setType(int type)
Set identification type for this text label

Parameters:
type - identification type

getType

public int getType()
Get identification type for this label

Returns:
identification type

setPadX

public void setPadX(int pad)
Set pad ID in X

Parameters:
pad - pad id

getPadX

public int getPadX()
Get pad ID in X

Returns:
pad ID

setPadY

public void setPadY(int pad)
Set pad ID in Y

Parameters:
pad - pad id

getPadY

public int getPadY()
Get pad ID in Y

Returns:
pad ID

getFont

public final Font getFont()
Returns the textFont property of this text object.

Returns:
The textFont property of this text object.

setFont

public final void setFont(Font font)
Sets the textFont property of this text object.

Parameters:
font - The textFont property of this text object.

getRotAngle

public final int getRotAngle()
Returns the rotAngle property of this text object.

Returns:
The rotAngle property of this text object.

setRotAngle

public final void setRotAngle(int angle)
Sets the rotAngle property of this text object.

Parameters:
angle - The rotAngle property of this text object.

getText

public final String getText()
Returns the textString property of this text object.

Returns:
The textString property of this text object.

setText

public final void setText(String string)
Sets the textString property of this text object.

Parameters:
string - The textString property of this text object.

copy

public final JaObject copy()
Returns an exact copy of this label.

Specified by:
copy in class JaObject
Returns:
A copy of this label.

isCopy

public final boolean isCopy(JaObject comp)
Returns true if all serializable variables of this JaObject and those of the specified one are equal.

Specified by:
isCopy in class JaObject
Parameters:
comp - A JaObject to compare with.
Returns:
True if the objects are equal, false otherwise.

getGrabbedHandle

public final int getGrabbedHandle(int clickX,
                                  int clickY,
                                  int editmode)
Determines where on this JaObject a mouse click has ocurred.

Specified by:
getGrabbedHandle in class JaObject
Parameters:
clickX - The x position of the point where the mouse click ocurred.
clickY - The y position of the point where the mouse click ocurred.
editmode - The current edit mode as defined in JaxoMainPanel.
Returns:
An integer specifying whether the click ocurred on one of the handles and if yes, on which.

jaxoDraw

public final void jaxoDraw(org.freehep.graphics2d.VectorGraphics g2,
                           boolean drawToScreen)
The method that draws this label.

Specified by:
jaxoDraw in class JaObject
Parameters:
drawToScreen - Indicates whether the drawing happens on the screen, or elsewhere (eg, a file or a printer)
g2 - The graphics context where the label has to be drawn.

drawHandles

public final void drawHandles(org.freehep.graphics2d.VectorGraphics g2)
Draws the handles of this text object.

Specified by:
drawHandles in class JaObject
Parameters:
g2 - The current graphics context.

latexCommand

public final String latexCommand(float scale,
                                 Dimension canvasDim)
The LaTeX command that is necessary to draw the given label using the axodraw.sty package. This is not used for label.

Specified by:
latexCommand in class JaObject
Parameters:
scale - A scale factor to translate Java coordinates to LaTeX coordinates.
canvasDim - The current dimension of the canvas.
Returns:
A string that appears as a comment in the Latex file, indicating that there is a postscript text here.

rescaleObject

public final void rescaleObject(int orx,
                                int ory,
                                float scale)
Rescales this label by the scale factor scale, keeping the point (orx, ory) fixed.

Specified by:
rescaleObject in class JaObject
Parameters:
orx - The x-coordinate of the fixed point
ory - The y-coordinate of the fixed point
scale - The scale parameter

latexWidth

public final String latexWidth()
Returns the line width of this label. This is not used for label.

Specified by:
latexWidth in class JaObject
Returns:
Returns "%", corresponding to an empty comment line in LaTeX.

editPanel

public final boolean editPanel()
Brings up the edit panel that allows to change the parameters of this object.

Specified by:
editPanel in class JaObject
Returns:
True if the editing actually changed the object, false if the object has not been changed.

setAvailableFonts

public final void setAvailableFonts(String[] fonts)
Sets the string array of available fonts.

Parameters:
fonts - The string array of available fonts.

print

public final void print()


jHepWork 3.0 ©