Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
GObject
org.gnu.gtk.GtkObject
org.gnu.gtk.Widget
org.gnu.gtk.Misc
org.gnu.gtk.Label
public class Label
extends Misc
label = new Label(""); label.setMarkup("<small>Small text</small>");(See complete documentation of available tags in the Pango manual.) The markup passed to setMarkup must be valid; for example, literal </>/& characters must be escaped as <, >, and &. If you pass text obtained from the user, file, or a network to setMarkup, you'll want to escape it with g_markup_escape_text(). Markup strings are just a convenient way to set the PangoAttrList on a label; setAttributes may be a simpler way to set attributes in some cases. Be careful though; PangoAttrList tends to cause internationalization problems, unless you're applying attributes to the entire string . The reason is that specifying the startIndex and endIndex for a PangoAttribute requires knowledge of the exact string being displayed, so translations will cause problems.
Constructor Summary | |
| |
| |
|
Method Summary | |
double |
|
AttrList |
|
EllipsizeMode |
|
Justification |
|
String |
|
static Label |
|
boolean |
|
int |
|
Widget |
|
boolean |
|
boolean |
|
int |
|
int |
|
boolean |
|
String |
|
static Type |
|
boolean |
|
boolean |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class org.gnu.gtk.Misc | |
getType , getXAlign , getXPadding , getYAlign , getYPadding , setAlignment , setPadding |
public Label(Handle handle)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Construct a label using a handle to a native resource.
public Label(String caption)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Creates a new label widget displaying the given caption. Mnemonic characters are not interpreted if this constructor is used.
- Parameters:
caption
- The default text to be displayed on the label
public Label(String caption, boolean hasMnemonic)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Creates a new label widget displaying the given caption.
- Parameters:
caption
- The default text to be displayed on the labelhasMnemonic
- If true, the caption is interpreted to have mnemonic characters. See the description for this class for more details.
public double getAngle()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Gets the angle of rotation for the label.
- Returns:
- the angle of rotation for the label
- Since:
- 2.6
- See Also:
setAngle(double)
public AttrList getAttributes()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Gets the attribute list that was set on the label using setAttributes, if any. This function does not reflect attributes that come from the labels markup (see setMarkup). If you want to get the effective attributes for the label, use pango.layout.getAttribute
- Returns:
- the Pango Attributes list
public EllipsizeMode getEllipsize()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns the ellipsizing position.
- Since:
- 2.6
public Justification getJustification()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns the justification of the label.
- Returns:
- the justification of the label
- See Also:
setJustification(Justification)
public String getLabel()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Fetches the text from a label widget including any embedded underlines indicating mnemonics and Pango markup.
- Returns:
- The entry text of the label.
public static Label getLabel(Handle handle)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Construct a label using a handle to a native resource.
public boolean getLineWrap()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns whether lines in the label are automatically wrapped.
- Returns:
- True if lines are automatically wrapped
public int getMaxWidthChars()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Retrieves the desired maximum width of label, in characters.
- Returns:
- the maximum width of the label in characters.
- Since:
- 2.6
- See Also:
setMaxWidthChars(int)
public Widget getMnemonicWidget()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Retrieves the target of the mnemonic (keyboard shortcut) of this label
- Returns:
- Target Widget
public boolean getSelectable()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Gets the value set by setSelectable.
- Returns:
- TRUE if the user can copy text from the label.
public boolean getSelected()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns true if any part of the label is selected
public int getSelectionEnd()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns the index of the end of the selected test. If no text is selected, this returns -1.
public int getSelectionStart()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns the index of the start of the selected text. If the text is not selected, this returns -1;
public boolean getSingleLineMode()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns whether the label is in single line mode.
- Returns:
- true when the label is in single line mode.
- Since:
- 2.6
public String getText()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns the text which is being displayed on this label.
- Returns:
- the text which is being displayed.
public static Type getType()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Retrieve the runtime type used by the GLib library.
public boolean getUseMarkup()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns whether the label's text is interpreted as marked up with the Pango text markup language.
- Returns:
- TRUE if the label's text will be parsed for markup.
- See Also:
setUseMarkup(boolean)
public boolean getUseMnemonic()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Returns whether an embedded underline in the label indicates a mnemonic.
- Returns:
- Whether an embedded underline in the label indicates the mnemonic accelerator keys.
- See Also:
setUseMnemonic(boolean)
public int getWidthChars()
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Retrieves the desired width of label, in characters.
- Returns:
- the width of the label in characters.
- Since:
- 2.6
- See Also:
setWidthChars(int)
public void select(int startOffset, int endOffset)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Selects a range of characters in the label, if the label is selectable. If the label is not selectable, this function has no effect. If startOffset or endOffset are -1, then the end of the label will be substituted.
- Parameters:
startOffset
- The start offset in charactersendOffset
- The end offset in characters
- See Also:
setSelectable(boolean)
public void setAngle(double angle)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets the angle of rotation for the label. An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom. The angle setting for the label is ignored if the label is selectable, wrapped, or ellipsized.
- Parameters:
angle
- the angle that the baseline of the label makes with the horizontal, in degrees, measured counterclockwise
- Since:
- 2.6
public void setAttributes(AttrList attributes)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets a PangoAttrList; the attributes in the list are applied to the label text. The attributes set with this function will be ignored if Mnemonics or markup are being used.
- Parameters:
attributes
- Pange attrlist attributes to use
- See Also:
AttrList
public void setEllipsize(EllipsizeMode mode)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets the mode used to ellipsize (add an ellipsis: "...") the text if there is not enough space to render the entire string.
- Since:
- 2.6
public void setJustification(Justification justification)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets the alignment of the lines in the text of the label relative to each other. Justification.LEFT is the default value when the widget is first created. If you instead want to set the alignment of the label as a whole, use Misc.setAlignment instead. setJustify has no effect on labels containing only a single line.
public void setLabel(String label)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets the text of the label.
- Parameters:
label
- The new text to set for the label
public void setLineWrap(boolean wrap)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Toggles line wrapping within the Label widget. TRUE makes it break lines if text exceeds the widget's size. FALSE lets the text get cut off by the edge of the widget if it exceeds the widget size.
- Parameters:
wrap
- New line wrap setting.
public void setMarkup(String markup)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Parsesmarkup
which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results. The markup should not contain mnemonic characters if this method is used.
- Parameters:
markup
- String containing pango markup
public void setMarkup(String markup, boolean hasMnemonic)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Parsesmarkup
which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results.
- Parameters:
markup
- String containing pango markuphasMnemonic
- If true, the markup string will be interpreted to contain mnemonic characters, for use as keyboard accelerators
public void setMaxWidthChars(int chars)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets the desired maximum width in characters to chars.
- Parameters:
chars
- the new desired maximum width, in characters.
- Since:
- 2.6
public void setMnemonicWidget(Widget widget)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
If the label has been set so that it has an mnemonic key, the label can be associated with a widget that is the target of the mnemonic. When the label is inside a widget (like a Button or a Notebook tab) it is automatically associated with the correct widget, but sometimes (i.e. when the target is an Entry next to the label) you need to set it explicitly using this function. The target widget will be accelerated by emitting "mnemonic_activate" on it. The default handler for this signal will activate the widget if there are no mnemonic collisions and toggle focus between the colliding widgets otherwise.
- Parameters:
widget
- The target widget
public void setSelectable(boolean setting)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Selectable labels allow the user to select text from the label, for copy-and-paste.
- Parameters:
setting
- TRUE to allow selecting text in the label
public void setSingleLineMode(boolean singleLineMode)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets whether the label is in single line mode.
- Parameters:
singleLineMode
- true if the label should be in single line mode
- Since:
- 2.6
public void setText(String caption)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Changes the text to be displayed in the label widget.
- Parameters:
caption
- the new text to be displayed.
public void setUnderlinePattern(String pattern)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
The pattern of underlines you want under the existing text within the Label widget. For example if the current text of the label says "FooBarBaz" passing a pattern of "___ ___" will underline "Foo" and "Baz" but not "Bar".
- Parameters:
pattern
- The pattern as described above.
public void setUseMarkup(boolean setting)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets whether the text of the label contains markup in Pango's text markup language.
- Parameters:
setting
- TRUE if the label's text should be parsed for markup.
- See Also:
setMarkup(String,boolean)
public void setUseMnemonic(boolean setting)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
If true, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
- Parameters:
setting
- TRUE if underlines in the text indicate mnemonics
public void setWidthChars(int chars)
Deprecated. Superceeded by java-gnome 4.0; a method along these lines may well exist in the new bindings, but if it does it likely has a different name or signature due to the shift to an algorithmic mapping of the underlying native libraries.
Sets the desired width in characters of label to chars.
- Parameters:
chars
- the new desired width, in characters.
- Since:
- 2.6