|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.tuwien.ifs.somtoolbox.apps.server.LabelDescription
public class LabelDescription
This class represents all the information needed to draw a specific label - its psition, font, rotation, etc.
Field Summary | |
---|---|
private Color |
color
The colour to draw the label with. |
static Font |
DEFAULT_FONT
The default font of all labels. |
private Font |
font
The font to draw the label with. |
private float |
fontSize
The font size to draw the label with. |
private double |
rotation
The rotation of the label. |
private String |
text
The label text. |
private boolean |
visible
|
private int |
x
The horizontal position of the label. |
private int |
y
The vertical position of the label. |
Constructor Summary | |
---|---|
LabelDescription(String text,
float fontSize,
int x,
int y,
double rotation,
boolean visible)
|
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares two LabelDescription with each other. |
Color |
getColor()
Gets the current colour of this label. |
Font |
getFont()
Gets the current font of this label. |
Font |
getFont(double scale)
Gets a scaled version of the current font. |
float |
getFontSize()
Gets the current font size of this label. |
double |
getFontSize(double scale)
Gets scaled value of the current font size of this label. |
double |
getRotation()
Gets the current rotation of this label. |
String |
getText()
Gets the current text of this label. |
int |
getX()
|
int |
getX(double scale)
Calculates a scaled x position of the label, by the given scale factor |
int |
getY()
|
int |
getY(double scale)
Calculates a scaled y position of the label, by the given scale factor |
int |
getYBaseline(FontMetrics fontMetrics)
Calculates the offset y position, considering font ascents. |
int |
getYBaseline(FontMetrics fontMetrics,
double scale,
int lineNumber)
Calculates a scaled offset y position, considering font ascents. |
boolean |
isVisible()
|
void |
setColor(Color color)
Sets a new colour for the label. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Font DEFAULT_FONT
private Color color
private Font font
DEFAULT_FONT
, with only the size
modified to fontSize
private float fontSize
font
.
private double rotation
private String text
private int x
private int y
private boolean visible
Constructor Detail |
---|
public LabelDescription(String text, float fontSize, int x, int y, double rotation, boolean visible)
Method Detail |
---|
public boolean equals(Object obj)
LabelDescription
with each other. They are considered identical if the values of
getText()
, getX()
, getY()
, getFontSize()
, getColor()
and
getRotation()
are equal.
equals
in class Object
public Color getColor()
public Font getFont()
public Font getFont(double scale)
public float getFontSize()
public double getFontSize(double scale)
public double getRotation()
public String getText()
public int getX()
public int getX(double scale)
scale
- the scale factor
public int getY()
public int getY(double scale)
scale
- the scale factor
public int getYBaseline(FontMetrics fontMetrics)
fontMetrics
- metric to calculate the ascents.
public int getYBaseline(FontMetrics fontMetrics, double scale, int lineNumber)
fontMetrics
- metric to calculate the ascents.scale
- the scale factorlineNumber
- the line number of the string, used when wanting to print multi-line labels
public void setColor(Color color)
public boolean isVisible()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |