com.threerings.opengl.gui
Class Label

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.TextComponent
          extended by com.threerings.opengl.gui.Label
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, UIConstants
Direct Known Subclasses:
Button, ComboBox, MenuItem, StatusLabel

public class Label
extends TextComponent
implements UIConstants

A simple component for displaying a textual label.


Nested Class Summary
static class Label.Fit
          Configures the label's strategy when it does not fit into its allocated space.
 
Field Summary
 
Fields inherited from class com.threerings.opengl.gui.Component
DEFAULT, DISABLED, HOVER
 
Fields inherited from interface com.threerings.opengl.gui.UIConstants
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL
 
Constructor Summary
Label(GlContext ctx, Icon icon)
          Creates a label that will display the supplied icon.
Label(GlContext ctx, Icon icon, String text)
          Creates a label that will display the supplied text and icon using the specified style config.
Label(GlContext ctx, String text)
          Creates a label that will display the supplied text.
 
Method Summary
 Label.Fit getFit()
          Returns the current fit mode for this label.
 Icon getIcon()
          Returns the icon being displayed by this label.
 int getIconTextGap()
          Returns the gap between the icon and the text.
 LabelRenderer getLabelRenderer()
          Returns a reference to teh label's renderer.
 String getText()
          Returns the text currently being displayed by this component.
 void setFit(Label.Fit mode)
          Configures whether this label will wrap, truncate or scale if it cannot fit text into its allotted width.
 void setIcon(Icon icon)
          Configures the label to display the specified icon.
 void setIconTextGap(int gap)
          Configures the gap between the icon and the text.
 void setOrientation(int orient)
          Sets the orientation of this label with respect to its icon.
 void setPreferredWidth(int width)
          Configures the preferred width of this label (the preferred height will be calculated from the font).
 void setText(String text)
          Updates the text displayed by this component.
 void setTextRotation(int rotation)
          Sets the rotation for the text (in ninety degree increments).
 
Methods inherited from class com.threerings.opengl.gui.TextComponent
getEffectColor, getEffectSize, getHorizontalAlignment, getLineSpacing, getTextEffect, getTextFactory, getVerticalAlignment
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, dispatchEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFocusTarget, getHeight, getHitComponent, getInsets, getParent, getPreferredSize, getProperty, getState, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getX, getY, hasFocus, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, requestFocus, scrollRectToVisible, setAlpha, setBackground, setBounds, setCursor, setEnabled, setHoverable, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Label

public Label(GlContext ctx,
             String text)
Creates a label that will display the supplied text.


Label

public Label(GlContext ctx,
             Icon icon)
Creates a label that will display the supplied icon.


Label

public Label(GlContext ctx,
             Icon icon,
             String text)
Creates a label that will display the supplied text and icon using the specified style config. All arguments can be null.

Method Detail

setIcon

public void setIcon(Icon icon)
Configures the label to display the specified icon.


getIcon

public Icon getIcon()
Returns the icon being displayed by this label.


setIconTextGap

public void setIconTextGap(int gap)
Configures the gap between the icon and the text.


getIconTextGap

public int getIconTextGap()
Returns the gap between the icon and the text.


setTextRotation

public void setTextRotation(int rotation)
Sets the rotation for the text (in ninety degree increments).


setOrientation

public void setOrientation(int orient)
Sets the orientation of this label with respect to its icon. If the horizontal (the default) the text is displayed to the right of the icon, if vertical the text is displayed below it.


setFit

public void setFit(Label.Fit mode)
Configures whether this label will wrap, truncate or scale if it cannot fit text into its allotted width. The default is to wrap.


getFit

public Label.Fit getFit()
Returns the current fit mode for this label.


setPreferredWidth

public void setPreferredWidth(int width)
Configures the preferred width of this label (the preferred height will be calculated from the font).


getLabelRenderer

public LabelRenderer getLabelRenderer()
Returns a reference to teh label's renderer.


setText

public void setText(String text)
Description copied from class: TextComponent
Updates the text displayed by this component.

Specified by:
setText in class TextComponent

getText

public String getText()
Description copied from class: TextComponent
Returns the text currently being displayed by this component.

Specified by:
getText in class TextComponent


Copyright © 2011. All Rights Reserved.