public class GraphLabel extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
CHECK |
static int |
DATA |
static int |
KEY |
static int |
OTHER |
static int |
PIPER_X1 |
static int |
PIPER_X2 |
static int |
PIPER_Y1 |
static int |
PIPER_Y2 |
static int |
PIPER_Y3 |
static int |
PIPER_Y4 |
static int |
STATBOX |
static int |
TITLE |
static int |
UNKNOWN |
static int |
XLABEL |
static int |
YLABEL |
Constructor and Description |
---|
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,
Font f,
Color c)
Constructor, sets the text of the label.
|
GraphLabel(int t,
String s)
Constructor, sets the text of the label.
|
GraphLabel(int t,
String s,
Font f,
Color c)
Constructor, sets the text of the label.
|
GraphLabel(String s)
Constructor, sets the text of the label.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Checks whether x,y falls within the bounding box of the current text.
|
boolean |
contains(double x,
double y,
float scale) |
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(String name)
returns true if the current label corresponds to one of the pre-defined
label types (X-label, Y-label etc).
|
AttributedCharacterIterator |
getCharIterator()
Returns an attributedCharacterIterator instance of the current text.
|
Color |
getColor() |
File |
getFile() |
Font |
getFont()
Sets the font to a specific value
|
double |
getHeight()
Returns the height of the bounding box of the label
|
int |
getID() |
Color |
getKeyColor() |
float |
getKeyLineWidth() |
float |
getKeySize() |
float |
getKeySpace() |
int |
getKeyType() |
int |
getMultiLines()
Get the multi text of the label
|
String[] |
getMultiText()
Get the multi text of the label
|
double |
getRotation()
Returns the rotation angle.
|
void |
getSettings(XMLWrite xw)
Returns the settings of the current label in a XML instance.
|
String |
getText() |
double |
getTextDescent()
Returns the text descent
|
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) |
void |
setColor(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(File f)
Sets the file to which the label belongs.
|
void |
setFont(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 |
setKey(int key_type,
float key_size,
Color key_color)
Sets a key
|
void |
setKeyLineWidth(float key_line_width)
Sets a key line width
|
void |
setKeySpace(float key_space)
Sets a space between the key and the text describing the key
|
void |
setLocation(double x,
double y)
This function 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 |
setSpace()
add a space
|
void |
setText(String s)
Sets the text of the label to something new.
|
void |
setText(String[] s)
Sets the multi text of the label to something new.
|
void |
setTextSize(double w,
double h)
Sets the size of the text-label:
|
void |
setUseDataPosition(boolean b)
Allows the user to used the current x- and y-positions using the data
coordinates, will use default positions otherwise
|
void |
setUsePosition(boolean b)
Allows the user to used the current x- and y-positions, will use default
positions otherwise.
|
String |
toString() |
void |
updateSettings(XMLRead xr)
Update the current label with the settings.
|
boolean |
useDataPosition() |
boolean |
usePosition() |
public static final int UNKNOWN
public static final int XLABEL
public static final int YLABEL
public static final int TITLE
public static final int PIPER_X1
public static final int PIPER_X2
public static final int PIPER_Y1
public static final int PIPER_Y2
public static final int PIPER_Y3
public static final int PIPER_Y4
public static final int DATA
public static final int OTHER
public static final int CHECK
public static final int STATBOX
public static final int KEY
public GraphLabel(int t, String s, Font f, Color c)
t
- type of this labels
- text of the labelf
- font of the labelc
- text color of the labelpublic GraphLabel(int t, Font f, Color c)
t
- type of this labelf
- font of the labelc
- text color of the labelpublic GraphLabel(int t, String s)
s
- new text of the labelpublic GraphLabel(String s)
s
- new text of the labelpublic GraphLabel(int t)
t
- ID of the labelpublic GraphLabel()
public GraphLabel(GraphLabel gl)
public void setKey(int key_type, float key_size, Color key_color)
key_type
- type of the key. 0 means a boxkey_size
- size (i.e. length) a key in terms of character widthkey_color
- color of the keypublic void setKeyLineWidth(float key_line_width)
key_line_width
- line width to draw the keypublic Color getKeyColor()
public float getKeySize()
public float getKeyLineWidth()
public int getKeyType()
public float getKeySpace()
public void setKeySpace(float key_space)
key_space
- key space in terms of character widthpublic void copy(GraphLabel gl)
public void setSpace()
s
- new text for the labelpublic void setText(String s)
s
- new text for the labelpublic void setText(String[] s)
s
- [] new text for the labelpublic String[] getMultiText()
public int getMultiLines()
public String getText()
public AttributedCharacterIterator getCharIterator()
public void setColor(Color c)
c
- color used to draw the labelpublic Color getColor()
public void setFont(Font f)
f
- font used to draw the labelpublic Font getFont()
public void setActive(boolean b)
b
- true if the user starts to draw the labelpublic boolean isActive()
public void setUsePosition(boolean b)
b
- true if the positions should be usedpublic void setUseDataPosition(boolean b)
b
- true if the positions should be usedpublic boolean usePosition()
public boolean useDataPosition()
public boolean hide()
public void hide(boolean h)
h
- flag, true if the label should'nt showpublic boolean equals(int type)
type
- type to compare with (must be an int)public boolean equals(String name)
name
- name to compare with (must be a string)public void setID(int type)
type
- type of the current labelpublic int getID()
public void setDataRotation(double r)
r
- angle for this labelpublic void setRotation(double r)
r
- angle for this labelpublic double getRotation()
public void setLocation(double x, double y)
x
- x-position of the lower-left corner of the texty
- y-position of the lower-left corner of the textpublic void setDataLocation(double x, double y)
x
- x-position of the lower-left corner of the texty
- y-position of the lower-left corner of the textpublic double getXPos()
public double getYPos()
public double getX()
public double getY()
public void setSize(double w, double h)
w
- width of the bbh
- height of the bbpublic void setTextSize(double w, double h)
w
- width of the labelh
- height of the labelpublic double getWidth()
public double getHeight()
public double getTextWidth()
public double getTextHeight()
public double getTextDescent()
public File getFile()
public void setFile(File f)
f
- file to which the label belongspublic String toString()
public boolean contains(double x, double y)
x
- x-positiony
- y-positionpublic boolean contains(double x, double y, float scale)
public void getSettings(XMLWrite xw)
xw
- instance of the class containing the settings.public void updateSettings(XMLRead xr)
xr
- instance of the reader class, containing the settings.Jas4pp 1.5 © Java Analysis Studio for Particle Physics