Package net.sf.jaxodraw.object.text
Class JaxoPSText
- java.lang.Object
-
- net.sf.jaxodraw.object.JaxoObject
-
- net.sf.jaxodraw.object.text.JaxoTextObject
-
- net.sf.jaxodraw.object.text.JaxoPSText
-
- All Implemented Interfaces:
java.awt.Shape
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,JaxoRotationObject
public class JaxoPSText extends JaxoTextObject
Defines a JaxoObject 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.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.sf.jaxodraw.object.JaxoObject
D_FORMAT, GRAY_SCALE_FORMAT, SELECT_NONE, SELECT_P1
-
-
Constructor Summary
Constructors Constructor Description JaxoPSText()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JaxoObject
copy()
Returns an exact copy of this JaxoPSText.void
copyFrom(JaxoPSText temp)
Sets all parameters from the given object to the current one.java.awt.Rectangle
getBounds()
Returns the bounding box of this object.java.awt.Font
getFont()
Returns the textFont property of this text object.static java.util.List<java.lang.Integer>
getFontSizeDefaults()
List of numbers of default font sizes to display to the user.static java.util.List<java.lang.Integer>
getFontStyles()
List of Integer font styles to display to the user.boolean
isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.java.lang.String
latexCommand(float scale, java.awt.Dimension canvasDim)
The LaTeX command that is necessary to draw the given JaxoObject using the axodraw.sty package.void
paint(JaxoGraphics2D g2)
The method that paints the JaxoObject.void
prepareEditPanel(JaxoObjectEditPanel editPanel)
Initializes the given editPanel to edit properties of this JaxoObject.void
rescaleObject(int orx, int ory, float scale)
Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.void
setFont(java.awt.Font font)
Sets the textFont property of this text object.void
setFontName(java.lang.String name)
Sets the font name of this text.void
setFontSize(int size)
Sets the font size of this text.void
setFontStyle(int style)
Sets the font style of this text.void
setPreferences()
Applies default values to this JaxoObject.void
setState(JaxoObject o)
Restore state to the values of 'o'.void
setTextString(java.lang.String string)
Sets the textString property of this text object.-
Methods inherited from class net.sf.jaxodraw.object.text.JaxoTextObject
canBeSelected, copyFrom, getRotationAngle, getTextString, latexWidth, paintHandles, setRotationAngle
-
Methods inherited from class net.sf.jaxodraw.object.JaxoObject
addPropertyChangeListener, contains, contains, contains, contains, copyFrom, firePropertyChange, getBounds2D, getBoundsWithHandles, getColor, getGeneralPath, getGrabbedHandle, getHeight, getLaTexLocation, getName, getPathIterator, getPathIterator, getPointCount, getPoints, getWidth, getX, getX, getY, getY, intersects, intersects, isAround, isMarked, moveBy, paintVisualAid, propertyChange, removePropertyChangeListener, setAsMarked, setColor, setLocation, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setPointCount, setPoints, setTransient, setX, setX, setXPosition, setY, setY, setYPosition, smallestDistanceTo
-
-
-
-
Method Detail
-
getFontSizeDefaults
public static java.util.List<java.lang.Integer> getFontSizeDefaults()
List of numbers of default font sizes to display to the user.- Returns:
- List of Integers.
- See Also:
Font.getStyle()
,Font.deriveFont(int)
-
getFontStyles
public static java.util.List<java.lang.Integer> getFontStyles()
List of Integer font styles to display to the user.- Returns:
- List of Integers.
-
getFont
public final java.awt.Font getFont()
Returns the textFont property of this text object.- Returns:
- The textFont property of this text object.
-
setFont
public final void setFont(java.awt.Font font)
Sets the textFont property of this text object.- Parameters:
font
- The textFont property of this text object.
-
setTextString
public void setTextString(java.lang.String string)
Sets the textString property of this text object.- Overrides:
setTextString
in classJaxoTextObject
- Parameters:
string
- The textString property of this text object.
-
setFontName
public final void setFontName(java.lang.String name)
Sets the font name of this text. If the current font is null, the style and size of the font are taken from the preferences.- Parameters:
name
- the font name to set.
-
setFontStyle
public final void setFontStyle(int style)
Sets the font style of this text. If the current font is null, the name and size of the font are taken from the preferences.- Parameters:
style
- the font style to set.
-
setFontSize
public final void setFontSize(int size)
Sets the font size of this text. If the current font is null, the style and name of the font are taken from the preferences.- Parameters:
size
- the font size to set.
-
copy
public final JaxoObject copy()
Returns an exact copy of this JaxoPSText.- Overrides:
copy
in classJaxoObject
- Returns:
- A copy of this JaxoPSText.
-
copyFrom
public void copyFrom(JaxoPSText temp)
Sets all parameters from the given object to the current one.- Parameters:
temp
- The object to copy from.
-
setState
public void setState(JaxoObject o)
Restore state to the values of 'o'. The object 'o' must be an object of the same "type" obtained byJaxoObject.copy()
.- Overrides:
setState
in classJaxoTextObject
- Parameters:
o
- the object to copy from.
-
isCopy
public final boolean isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.- Overrides:
isCopy
in classJaxoTextObject
- Parameters:
comp
- The JaxoObject to compare against.- Returns:
- True if the JaxoObjects are identical.
-
paint
public final void paint(JaxoGraphics2D g2)
The method that paints the JaxoObject.- Specified by:
paint
in classJaxoObject
- Parameters:
g2
- The graphics context where the object has to be painted.
-
getBounds
public java.awt.Rectangle getBounds()
Returns the bounding box of this object.- Returns:
- the bounding box of this object.
-
latexCommand
public final java.lang.String latexCommand(float scale, java.awt.Dimension canvasDim)
The LaTeX command that is necessary to draw the given JaxoObject using the axodraw.sty package.- Specified by:
latexCommand
in classJaxoObject
- Parameters:
scale
- A scale factor to translate Java coordinates to LaTeX coordinates.canvasDim
- The current dimension of the canvas.- Returns:
- The corresponding axodraw LaTeX command.
-
prepareEditPanel
public void prepareEditPanel(JaxoObjectEditPanel editPanel)
Initializes the given editPanel to edit properties of this JaxoObject.- Specified by:
prepareEditPanel
in classJaxoObject
- Parameters:
editPanel
- the panel to prepare.
-
rescaleObject
public final void rescaleObject(int orx, int ory, float scale)
Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.- Overrides:
rescaleObject
in classJaxoTextObject
- Parameters:
orx
- The x-coordinate of the fixed point.ory
- The y-coordinate of the fixed point.scale
- The scale parameter.
-
setPreferences
public void setPreferences()
Applies default values to this JaxoObject. All fields except location points are initialized with values taken from thepreferences
.- Overrides:
setPreferences
in classJaxoTextObject
-
-