|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.erichseifert.gral.AbstractDrawable
de.erichseifert.gral.plots.Label
public class Label
Class that draws a label to a specific location. A Label is able to manage its settings and to set and get the displayed text, as well as calculating its bounds.
Field Summary | |
---|---|
static Settings.Key |
ALIGNMENT_X
Key for specifying the horizontal alignment within the bounding rectangle. 0 means left, 1 means right. |
static Settings.Key |
ALIGNMENT_Y
Key for specifying the vertical alignment within the bounding rectangle. 0 means top, 1 means bottom. |
static Settings.Key |
ANCHOR
Key for specifying the DrawableConstants
value where the label will be aligned at. |
static Settings.Key |
COLOR
Key for specifying the Paint instance to be used to
paint the label shape. |
static Settings.Key |
FONT
Key for specifying the font of this label. |
static Settings.Key |
ROTATION
Key for specifying the rotation of this label, |
Constructor Summary | |
---|---|
Label(String text)
Creates a new Label object with the specified text. |
Method Summary | ||
---|---|---|
void |
draw(DrawingContext context)
Draws the Drawable with the specified
Graphics2D object. |
|
Dimension2D |
getPreferredSize()
Returns the preferred size of the Drawable . |
|
|
getSetting(Settings.Key key)
Returns the setting with the specified key. |
|
String |
getText()
Returns the text of this label. |
|
Rectangle2D |
getTextRectangle()
Returns the bounding rectangle of the text. |
|
|
removeSetting(Settings.Key key)
Removes the setting with the specified key. |
|
|
removeSettingDefault(Settings.Key key)
Removes the default setting with the specified key. |
|
|
setSetting(Settings.Key key,
T value)
Sets the setting with the specified key to the specified value. |
|
|
setSettingDefault(Settings.Key key,
T value)
Sets a default value for the setting with the specified key. |
|
void |
setText(String text)
Sets the displayed text to the specified value. |
|
void |
settingChanged(SettingChangeEvent event)
Invoked if a setting has changed. |
Methods inherited from class de.erichseifert.gral.AbstractDrawable |
---|
getBounds, getHeight, getWidth, getX, getY, setBounds, setBounds |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Settings.Key ALIGNMENT_X
public static final Settings.Key ALIGNMENT_Y
public static final Settings.Key ANCHOR
DrawableConstants
value where the label will be aligned at.
public static final Settings.Key FONT
public static final Settings.Key ROTATION
public static final Settings.Key COLOR
Paint
instance to be used to
paint the label shape.
Constructor Detail |
---|
public Label(String text)
Label
object with the specified text.
text
- Text to be displayed.Method Detail |
---|
public void draw(DrawingContext context)
Drawable
Drawable
with the specified
Graphics2D
object.
draw
in interface Drawable
context
- Environment used for drawingpublic Dimension2D getPreferredSize()
Drawable
Drawable
.
getPreferredSize
in interface Drawable
getPreferredSize
in class AbstractDrawable
public Rectangle2D getTextRectangle()
public String getText()
public void setText(String text)
text
- Text to be displayed.public <T> T getSetting(Settings.Key key)
SettingsStorage
getSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.
public <T> void setSetting(Settings.Key key, T value)
SettingsStorage
setSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.value
- Value to be set.public <T> void removeSetting(Settings.Key key)
SettingsStorage
removeSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.public <T> void setSettingDefault(Settings.Key key, T value)
SettingsStorage
setSettingDefault
in interface SettingsStorage
T
- Type of setting.key
- Key.value
- Value to be set.public <T> void removeSettingDefault(Settings.Key key)
SettingsStorage
removeSettingDefault
in interface SettingsStorage
T
- Type of setting.key
- Key.public void settingChanged(SettingChangeEvent event)
SettingsListener
settingChanged
in interface SettingsListener
event
- Event containing information about the changed setting.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |