jhplot
Class HLabel
- java.lang.Object
-
- jhplot.HLabel
-
- All Implemented Interfaces:
- java.io.Serializable
public class HLabel extends java.lang.Object implements java.io.Serializable
Create an interactive label usingHPlot
canvas. The label can be defined in the NDC (normalized coordinate system) or the USER coordinate. Only one line of the text can be shown. To show several lines of the text, use- See Also:
class For more labels look at the shape package
, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HLabel(java.lang.String s)
Make a label with default attributesHLabel(java.lang.String s, double x, double y)
Make a label with specific coordinated in the data systemHLabel(java.lang.String s, double x, double y, java.lang.String howToSet)
Make a label with specific coordinates.HLabel(java.lang.String s, java.awt.Font f)
Make a label (color- black)HLabel(java.lang.String s, java.awt.Font f, java.awt.Color c)
Make a text label at (0,0) in the data coordinates (USER).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
doc()
Show online documentation.java.awt.Color
getColor()
Get color of a label.java.awt.Font
getFont()
Get the font of the label text.jplot.GraphLabel
getGraphLabel()
Get a label with default attributesint
getPositionCoordinate()
Is the position set?double
getRotation()
Returns the rotation angle.java.lang.String
getText()
Get the text of the label.double
getX()
Returns the X position of the text.double
getY()
Returns the Y position of the text.void
setColor(java.awt.Color c)
Sets the color to a specific valuevoid
setFont(java.awt.Font f)
Sets the font to a specific valuevoid
setLocation(double x, double y)
Sets the location of the label in the NDC coordinates.void
setLocation(double x, double y, java.lang.String howToSet)
Sets the location of the label in data coordinates.void
setRotation(double r)
Sets the rotation angle.void
setText(java.lang.String s)
Sets a text of the label.
-
-
-
Constructor Detail
-
HLabel
public HLabel(java.lang.String s, java.awt.Font f, java.awt.Color c)
Make a text label at (0,0) in the data coordinates (USER). The position is depends of the user coordinated, so consider NDC.- Parameters:
s
- Textf
- Fontc
- Color
-
HLabel
public HLabel(java.lang.String s, java.awt.Font f)
Make a label (color- black)- Parameters:
s
- Textf
- Font
-
HLabel
public HLabel(java.lang.String s)
Make a label with default attributes- Parameters:
s
- text
-
HLabel
public HLabel(java.lang.String s, double x, double y)
Make a label with specific coordinated in the data system- Parameters:
s
- Textx
- Position in Xy
- Position in Y
-
HLabel
public HLabel(java.lang.String s, double x, double y, java.lang.String howToSet)
Make a label with specific coordinates.- Parameters:
s
- Textx
- position in Xy
- position in YhowToSet
- set it to "NDC" for normalized coordinates (in the range 0-1). This is a data independent position set it to "USER" for the user coordinates
-
-
Method Detail
-
setText
public void setText(java.lang.String s)
Sets a text of the label.- Parameters:
s
- new text for the label
-
getText
public java.lang.String getText()
Get the text of the label.- Returns:
- the current text of the label
-
setColor
public void setColor(java.awt.Color c)
Sets the color to a specific value- Parameters:
c
- color used to draw the label
-
getColor
public java.awt.Color getColor()
Get color of a label.- Returns:
- the color used to draw the label
-
setFont
public void setFont(java.awt.Font f)
Sets the font to a specific value- Parameters:
f
- font used to draw the label
-
getFont
public java.awt.Font getFont()
Get the font of the label text.- Returns:
- the font used to draw the label
-
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.- Parameters:
r
- angle for this label
-
getRotation
public double getRotation()
Returns the rotation angle.- Returns:
- angle for this label
-
setLocation
public void setLocation(double x, double y)
Sets the location of the label in the NDC coordinates. Ones set this way, you cannot plot the label, it must first define the location in pixel-coordinates (setLocation(x,y));- Parameters:
x
- x-position of the lower-left corner of the texty
- y-position of the lower-left corner of the text
-
setLocation
public void setLocation(double x, double y, java.lang.String howToSet)
Sets the location of the 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));- Parameters:
x
- x-position of the lower-left corner of the texty
- y-position of the lower-left corner of the texthowToSet
- set it to "NDC" for normalized coordinates (in the range 0-1). This is a data independent position set it to "USER" for the user coordinates
-
getPositionCoordinate
public int getPositionCoordinate()
Is the position set?- Returns:
- zero if location is not defined of unity if the position is defined in the NDC system 2 if the location is defined in the user coordinates
-
getX
public double getX()
Returns the X position of the text.- Returns:
- the x-position of the text
-
getY
public double getY()
Returns the Y position of the text.- Returns:
- the y-position of the text
-
getGraphLabel
public jplot.GraphLabel getGraphLabel()
Get a label with default attributes- Returns:
- get GraphLabel
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG