org.gnome.gtk
Class Label
java.lang.Object
org.freedesktop.bindings.Proxy
A Widget that displays a small amount of text.
Labels are the backbone of any Window. They are frequently used to identify
other controls with names, as headings in Windows, and are the building
blocks that Menus and Buttons are made up of. All the difficult parts about
rendering text are taken care of here, such as text direction, fonts. And,
of course, you can enable them to allow their text to be copied.
Labels can display normal text or text that has been formatted with Pango
markup. FIXME with a reference to our Pango guide page.
Although you can pack multiple lines into a Label, there does come a point
when the amount of text you're trying to show gets out of hand. At that
point you might want to investigate the
TextView
Widget.
- Andrew Cowie
- Srichand Pendyala
Label(String text) - Create a Label with the specified text.
|
double | getAngle() - Get the current angle of the Label.
|
String | getLabel() - Get the text showing in the Label, including any characters which
indicate Pango markup syntax and embedded mnemonic underline characters
that may be present.
|
String | getText() - Get the text showing in the Label, but with any Pango markup stripped
away.
|
void | setAngle(double angle) - Sets the angle of rotation for the Label.
|
void | setLabel(String text) - Set the text showing in the Label.
|
void | setUseMarkup(boolean setting) - Set whether the text showing in the Label is to be parsed as containing
markup in Pango's text markup language.
|
Label
public Label(String text)
Create a Label with the specified text. This Label will be an ordinary
one and will interpret the argument as plain unformatted text. Note
that if you use this constructor you can later switch the Label to
interpreting the text as Pango markup by calling
setUseMarkup(true)
.
text
- the text you wish on the Label.
getAngle
public double getAngle()
Get the current angle of the Label. An angle of 90° means the text
reads in an upwards direction (ie from bottom to top), whereas an angle
of 270° means the text reads in a downwards direction (ie from top
to bottom).
getLabel
public String getLabel()
Get the text showing in the Label, including any characters which
indicate Pango markup syntax and embedded mnemonic underline characters
that may be present. Contrast with
getText()
which
returns the text unadorned.
getText
public String getText()
Get the text showing in the Label, but with any Pango markup stripped
away. This is useful if you've applied some fancy formatting but just
want to find out the actual words that appear to the user. It also
strips away any embedded underlines indicating mnemonics. If you need
the raw text including markup, then you want
getLabel()
.
setAngle
public void setAngle(double angle)
Sets the angle of rotation for the Label. The angle is measured in
degrees from the horizontal, going counter-clockwise. An angle of
90° reads from bottom to top, an angle of 270° from top to
bottom. The angle setting for the Label will be ignored if the Label is
selectable, wrapped, or ellipsized.
angle
- The angle that the baseline of the Label's text makes with
the horizontal. The valid range (as you'd expect) is from
0° through 360°.
setLabel
public void setLabel(String text)
Set the text showing in the Label.
text
- If the Label has been told to interpret Pango markup with
setUseMarkup(true)
, then any
markup included in text will be interpreted as such.
setUseMarkup
public void setUseMarkup(boolean setting)
Set whether the text showing in the Label is to be parsed as containing
markup in Pango's text markup language. Using this allows Labels to be
created with expressive formatting considerably more advanced than a
simple line of text.
setting
- If setting is true, then any markup included in the text is
interpreted as such. If its set to false, markup is ignored
and included as-is.
|  java-gnome |