|
|||||||||
| Home >> All >> [ jplot overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jplot
Class GraphLabel

java.lang.Objectjplot.GraphLabel
- public class GraphLabel
- extends java.lang.Object
This class defines a label in terms of the actual text, font, color and position but also stuff like rotation, whether to hide or show etc. Some special treatment for standard X, Y labels and a title. Random labels are considered to be of type OTHER, which places them, by default, in the lower-left corner of the graph. Extends Rectangle, since a label has a rectangular bounding box, used to select, drag and drop the label. Note that the bounding box is defined by the upper-left corner, width (to the right) and height (directed towards the bottom).
| Field Summary | |
private boolean |
active
|
private java.text.AttributedString |
attributedString
|
private double |
bbHeight
|
private double |
bbWidth
|
private double |
bbX
|
private double |
bbY
|
(package private) static int |
CHECK
|
private java.awt.Color |
color
|
private double |
cos
|
(package private) static int |
DATA
|
private java.io.File |
file
|
private java.awt.FontMetrics |
fm
|
private java.awt.Font |
font
|
private boolean |
hideLabel
|
private java.lang.String |
lf
|
(package private) static int |
OTHER
|
(package private) static int |
PIPER_X1
|
(package private) static int |
PIPER_X2
|
(package private) static int |
PIPER_Y1
|
(package private) static int |
PIPER_Y2
|
(package private) static int |
PIPER_Y3
|
(package private) static int |
PIPER_Y4
|
private double |
rotation
|
private double |
sin
|
private java.lang.String |
text
|
private double |
textHeight
|
private double |
textWidth
|
(package private) static int |
TITLE
|
(package private) static int |
UNKNOWN
|
private boolean |
usePos
|
private int |
whoAmI
|
(package private) static int |
XLABEL
|
private double |
xPos
|
(package private) static int |
YLABEL
|
private double |
yPos
|
| Constructor Summary | |
GraphLabel()
Constructor, does nothing but initializing. |
|
GraphLabel(GraphLabel gl)
Constructor, builds the class with another graph label. |
|
GraphLabel(int t)
Constructor, sets the ID of the label but no text. |
|
GraphLabel(int t,
java.lang.String s)
Constructor, sets the text of the label. |
|
GraphLabel(int t,
java.lang.String s,
java.awt.Font f,
java.awt.Color c)
Constructor, sets the text of the label. |
|
GraphLabel(java.lang.String s)
Constructor, sets the text of the label. |
|
| Method Summary | |
boolean |
contains(double x,
double y)
Checks whether x,y falls within the bounding box of the current text. |
void |
copy(GraphLabel gl)
Constructor, builds the class with another graph label. |
boolean |
equals(int type)
returns true if the current label corresponds to one of the pre-defined label types (X-label, Y-label etc). |
boolean |
equals(java.lang.String name)
returns true if the current label corresponds to one of the pre-defined label types (X-label, Y-label etc). |
java.text.AttributedCharacterIterator |
getCharIterator()
|
java.awt.Color |
getColor()
|
java.io.File |
getFile()
|
java.awt.Font |
getFont()
Sets the font to a specific value |
double |
getHeight()
Returns the height of the bounding box of the label |
int |
getID()
|
double |
getRotation()
Returns the rotation angle. |
java.lang.String |
getSettings()
Returns the settings of the current label in a string. |
java.lang.String |
getText()
|
double |
getTextHeight()
Returns the height of the text of the label |
double |
getTextWidth()
Returns the width of the text of the label |
double |
getWidth()
Returns the width of the bounding box of the label |
double |
getX()
Returns the X position of the bounding box. |
double |
getXPos()
Returns the X position of the text. |
double |
getY()
Returns the Y position of the bounding box. |
double |
getYPos()
Returns the Y position of the text. |
boolean |
hide()
|
void |
hide(boolean h)
sets the hide attribute of this label |
boolean |
isActive()
|
void |
setActive(boolean b)
|
private void |
setBoundingBox()
|
void |
setColor(java.awt.Color c)
Sets the color to a specific value |
void |
setDataLocation(double x,
double y)
Sets the location of this label in data coordinates. |
void |
setDataRotation(double r)
Sets the rotation angle. |
void |
setFile(java.io.File f)
Sets the file to which the label belongs. |
void |
setFont(java.awt.Font f)
Sets the font to a specific value |
void |
setID(int type)
Sets the current identity of the label to some specific value The idientity must be an int and, in principle, something predefined such as GraphLabel.XLABEL). |
void |
setLocation(double x,
double y)
This function also sets the text location of the label text itself, slightly different from the x,y position of the box. |
void |
setRotation(double r)
Sets the rotation angle. |
void |
setSize(double w,
double h)
Sets the size of the bounding box: |
void |
setText(java.lang.String s)
Sets the text of the label to something new. |
private void |
setTextMetrics()
|
void |
setTextSize(double w,
double h)
Sets the size of the text-label: |
void |
setUsePosition(boolean b)
Allows the user to used the current x- and y-positions, will use default positions otherwise |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
boolean |
usePosition()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
UNKNOWN
static final int UNKNOWN
- See Also:
- Constant Field Values
XLABEL
static final int XLABEL
- See Also:
- Constant Field Values
YLABEL
static final int YLABEL
- See Also:
- Constant Field Values
TITLE
static final int TITLE
- See Also:
- Constant Field Values
PIPER_X1
static final int PIPER_X1
- See Also:
- Constant Field Values
PIPER_X2
static final int PIPER_X2
- See Also:
- Constant Field Values
PIPER_Y1
static final int PIPER_Y1
- See Also:
- Constant Field Values
PIPER_Y2
static final int PIPER_Y2
- See Also:
- Constant Field Values
PIPER_Y3
static final int PIPER_Y3
- See Also:
- Constant Field Values
PIPER_Y4
static final int PIPER_Y4
- See Also:
- Constant Field Values
DATA
static final int DATA
- See Also:
- Constant Field Values
OTHER
static final int OTHER
- See Also:
- Constant Field Values
CHECK
static final int CHECK
- See Also:
- Constant Field Values
text
private java.lang.String text
font
private java.awt.Font font
color
private java.awt.Color color
active
private boolean active
usePos
private boolean usePos
fm
private java.awt.FontMetrics fm
rotation
private double rotation
whoAmI
private int whoAmI
xPos
private double xPos
yPos
private double yPos
bbX
private double bbX
bbY
private double bbY
textWidth
private double textWidth
textHeight
private double textHeight
bbWidth
private double bbWidth
bbHeight
private double bbHeight
sin
private double sin
cos
private double cos
attributedString
private java.text.AttributedString attributedString
file
private java.io.File file
hideLabel
private boolean hideLabel
lf
private final java.lang.String lf
| Constructor Detail |
GraphLabel
public GraphLabel(int t,
java.lang.String s,
java.awt.Font f,
java.awt.Color c)
- Constructor, sets the text of the label.
GraphLabel
public GraphLabel(int t,
java.lang.String s)
- Constructor, sets the text of the label.
GraphLabel
public GraphLabel(java.lang.String s)
- Constructor, sets the text of the label.
GraphLabel
public GraphLabel(int t)
- Constructor, sets the ID of the label but no text.
GraphLabel
public GraphLabel()
- Constructor, does nothing but initializing.
GraphLabel
public GraphLabel(GraphLabel gl)
- Constructor, builds the class with another graph label.
| Method Detail |
setBoundingBox
private void setBoundingBox()
setTextMetrics
private void setTextMetrics()
copy
public void copy(GraphLabel gl)
- Constructor, builds the class with another graph label.
setText
public void setText(java.lang.String s)
- Sets the text of the label to something new.
getText
public java.lang.String getText()
getCharIterator
public java.text.AttributedCharacterIterator getCharIterator()
setColor
public void setColor(java.awt.Color c)
- Sets the color to a specific value
getColor
public java.awt.Color getColor()
setFont
public void setFont(java.awt.Font f)
- Sets the font to a specific value
getFont
public java.awt.Font getFont()
- Sets the font to a specific value
setActive
public void setActive(boolean b)
isActive
public boolean isActive()
setUsePosition
public void setUsePosition(boolean b)
- Allows the user to used the current x- and y-positions,
will use default positions otherwise
usePosition
public boolean usePosition()
hide
public boolean hide()
hide
public void hide(boolean h)
- sets the hide attribute of this label
equals
public boolean equals(int type)
- returns true if the current label corresponds to one of
the pre-defined label types (X-label, Y-label etc).
equals
public boolean equals(java.lang.String name)
- returns true if the current label corresponds to one of
the pre-defined label types (X-label, Y-label etc).
setID
public void setID(int type)
- Sets the current identity of the label to some specific value
The idientity must be an int and, in principle, something predefined
such as GraphLabel.XLABEL).
getID
public int getID()
setDataRotation
public void setDataRotation(double r)
- Sets the rotation angle.
setRotation
public void setRotation(double r)
- Sets the rotation angle. Although all kind of angles (in PI-units)
are allowed, internally we only use the interval 0-2pi hence we
take care of all other cases.
getRotation
public double getRotation()
- Returns the rotation angle.
setLocation
public void setLocation(double x,
double y)
- This function also sets the text location of the label text
itself, slightly different from the x,y position of the box.
Optimize this function since it is used for drag'n drop.
setDataLocation
public void setDataLocation(double x,
double y)
- Sets the location of this label in data coordinates.
Ones set this way, you cannot plot the label, it must first
define the location in pixel-coordinates (setLocation(x,y));
getXPos
public double getXPos()
- Returns the X position of the text.
getYPos
public double getYPos()
- Returns the Y position of the text.
getX
public double getX()
- Returns the X position of the bounding box.
getY
public double getY()
- Returns the Y position of the bounding box.
setSize
public void setSize(double w,
double h)
- Sets the size of the bounding box:
setTextSize
public void setTextSize(double w,
double h)
- Sets the size of the text-label:
getWidth
public double getWidth()
- Returns the width of the bounding box of the label
getHeight
public double getHeight()
- Returns the height of the bounding box of the label
getTextWidth
public double getTextWidth()
- Returns the width of the text of the label
getTextHeight
public double getTextHeight()
- Returns the height of the text of the label
getFile
public java.io.File getFile()
setFile
public void setFile(java.io.File f)
- Sets the file to which the label belongs. Can be null.
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
contains
public boolean contains(double x,
double y)
- Checks whether x,y falls within the bounding box of the
current text.
getSettings
public java.lang.String getSettings()
- Returns the settings of the current label in a string.
Calling this method creates a string containing the name
and settings of the current label in string-format, formatted
such that it can directly be used for a script file.
|
|||||||||
| Home >> All >> [ jplot overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
jplot.GraphLabel