com.threerings.opengl.gui
Class LabelRenderer

java.lang.Object
  extended by com.threerings.opengl.gui.LabelRenderer
All Implemented Interfaces:
UIConstants

public class LabelRenderer
extends Object
implements UIConstants

Handles the underlying layout and rendering for Label and Button.


Field Summary
 
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
LabelRenderer(TextComponent container)
           
 
Method Summary
 Dimension computePreferredSize(int whint, int hhint)
          Computes the preferred size of the label.
 Icon getIcon()
          Returns the icon being displayed by this label.
 int getIconTextGap()
          Returns the gap between the icon and the text.
 int getIconX()
          Returns the x coordinate of the icon.
 int getIconY()
          Returns the y coordinate of the icon.
 String getText()
          Returns the text currently being displayed by this label.
 void layout(Insets insets, int contWidth, int contHeight)
          Lays out the label text and icon.
 void render(Renderer renderer, int x, int y, int contWidth, int contHeight, float alpha)
          Renders the label text and icon.
 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 label.
 void setTextRotation(int rotation)
          Sets the rotation for the text (in ninety degree increments).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelRenderer

public LabelRenderer(TextComponent container)
Method Detail

setText

public void setText(String text)
Updates the text displayed by this label.


getText

public String getText()
Returns the text currently being displayed by this label.


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.


setPreferredWidth

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


computePreferredSize

public Dimension computePreferredSize(int whint,
                                      int hhint)
Computes the preferred size of the label.


layout

public void layout(Insets insets,
                   int contWidth,
                   int contHeight)
Lays out the label text and icon.


getIconX

public int getIconX()
Returns the x coordinate of the icon.


getIconY

public int getIconY()
Returns the y coordinate of the icon.


render

public void render(Renderer renderer,
                   int x,
                   int y,
                   int contWidth,
                   int contHeight,
                   float alpha)
Renders the label text and icon.



Copyright © 2011. All Rights Reserved.