public class LabelDescription
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
color
The colour to draw the label with.
|
static java.awt.Font |
DEFAULT_FONT
The default font of all labels.
|
private java.awt.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 java.lang.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 and Description |
---|
LabelDescription(java.lang.String text,
float fontSize,
int x,
int y,
double rotation,
boolean visible) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares two
LabelDescription with each other. |
java.awt.Color |
getColor()
Gets the current colour of this label.
|
java.awt.Font |
getFont()
Gets the current font of this label.
|
java.awt.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.
|
java.lang.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(java.awt.FontMetrics fontMetrics)
Calculates the offset y position, considering font ascents.
|
int |
getYBaseline(java.awt.FontMetrics fontMetrics,
double scale,
int lineNumber)
Calculates a scaled offset y position, considering font ascents.
|
boolean |
isVisible() |
void |
setColor(java.awt.Color color)
Sets a new colour for the label.
|
public static java.awt.Font DEFAULT_FONT
private java.awt.Color color
private java.awt.Font font
DEFAULT_FONT
, with only the size
modified to fontSize
private float fontSize
font
.private double rotation
private java.lang.String text
private int x
private int y
private boolean visible
public LabelDescription(java.lang.String text, float fontSize, int x, int y, double rotation, boolean visible)
public boolean equals(java.lang.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 java.lang.Object
public java.awt.Color getColor()
public java.awt.Font getFont()
public java.awt.Font getFont(double scale)
public float getFontSize()
public double getFontSize(double scale)
public double getRotation()
public java.lang.String getText()
public int getX()
public int getX(double scale)
scale
- the scale factorpublic int getY()
public int getY(double scale)
scale
- the scale factorpublic int getYBaseline(java.awt.FontMetrics fontMetrics)
fontMetrics
- metric to calculate the ascents.public int getYBaseline(java.awt.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 labelspublic void setColor(java.awt.Color color)
public boolean isVisible()