com.threerings.opengl.gui
Class TextArea

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
          extended by com.threerings.opengl.gui.TextArea
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>

public class TextArea
extends Container

Displays one or more lines of text which may contain basic formatting (changing of color, toggling bold, italic and underline). Newline characters in the appended text will result in line breaks in the on-screen layout.


Field Summary
static int BOLD
          A font style constant.
static int ITALIC
          A font style constant.
static int PLAIN
          A font style constant.
 
Fields inherited from class com.threerings.opengl.gui.Component
DEFAULT, DISABLED, HOVER
 
Constructor Summary
TextArea(GlContext ctx)
           
TextArea(GlContext ctx, String text)
           
 
Method Summary
 void appendText(String text)
          Appends text with the foreground color in the plain style.
 void appendText(String text, Color4f color)
          Appends text with the specified color in the plain style.
 void appendText(String text, Color4f color, int style)
          Appends text with the specified color and style.
 void appendText(String text, int style)
          Appends text with the foreground color in the specified style.
 void clearText()
          Clears out the text displayed in this area.
 Color4f getEffectColor()
          Returns the color to use for our text effect.
 int getEffectSize()
          Returns the effect size for this component's text.
 int getHorizontalAlignment()
          Returns the horizontal alignment for this component's text.
 int getLineCount()
          Returns the number of lines of text contained in this area.
 BoundedRangeModel getScrollModel()
          Returns a model that can be wired to a scroll bar to allow scrolling up and down through the lines in this text area.
 int getTextEffect()
          Returns the effect for this component's text.
 TextFactory getTextFactory()
          Returns a text factory suitable for creating text in the style defined by the component's current state.
 TextFactory getTextFactory(int style)
          Returns a text factory suitable for creating text in the style defined by the component's current state.
 int getVerticalAlignment()
          Returns the vertical alignment for this component's text.
 void scrollToLine(int line)
          Scrolls our display such that the sepecified line is visible.
 void setEnabled(boolean enabled)
          Sets this components enabled state.
 void setPreferredWidth(int width)
          Configures the preferred width of this text area (the preferred height will be calculated from the font).
 void setText(String text)
          Clears any text in this text area and appends the supplied text.
 
Methods inherited from class com.threerings.opengl.gui.Container
add, add, add, add, getComponent, getComponentCount, getComponentIndex, getHitComponent, getLayoutManager, remove, remove, removeAll, replace, setAlpha, setHoverable, setLayoutManager, validate
 
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, 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, setBackground, setBounds, setCursor, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLAIN

public static final int PLAIN
A font style constant.

See Also:
Constant Field Values

BOLD

public static final int BOLD
A font style constant.

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
A font style constant.

See Also:
Constant Field Values
Constructor Detail

TextArea

public TextArea(GlContext ctx)

TextArea

public TextArea(GlContext ctx,
                String text)
Method Detail

getHorizontalAlignment

public int getHorizontalAlignment()
Returns the horizontal alignment for this component's text.


getVerticalAlignment

public int getVerticalAlignment()
Returns the vertical alignment for this component's text.


setPreferredWidth

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


getScrollModel

public BoundedRangeModel getScrollModel()
Returns a model that can be wired to a scroll bar to allow scrolling up and down through the lines in this text area.


setText

public void setText(String text)
Clears any text in this text area and appends the supplied text.


appendText

public void appendText(String text)
Appends text with the foreground color in the plain style.


appendText

public void appendText(String text,
                       Color4f color)
Appends text with the specified color in the plain style.


appendText

public void appendText(String text,
                       int style)
Appends text with the foreground color in the specified style.


appendText

public void appendText(String text,
                       Color4f color,
                       int style)
Appends text with the specified color and style.


clearText

public void clearText()
Clears out the text displayed in this area.


scrollToLine

public void scrollToLine(int line)
Scrolls our display such that the sepecified line is visible.


getLineCount

public int getLineCount()
Returns the number of lines of text contained in this area.


getTextFactory

public TextFactory getTextFactory()
Returns a text factory suitable for creating text in the style defined by the component's current state.


getTextFactory

public TextFactory getTextFactory(int style)
Returns a text factory suitable for creating text in the style defined by the component's current state.


getTextEffect

public int getTextEffect()
Returns the effect for this component's text.


getEffectSize

public int getEffectSize()
Returns the effect size for this component's text.


getEffectColor

public Color4f getEffectColor()
Returns the color to use for our text effect.


setEnabled

public void setEnabled(boolean enabled)
Description copied from class: Component
Sets this components enabled state. A component that is not enabled should not respond to user interaction and should render itself in such a way as not to afford user interaction.

Overrides:
setEnabled in class Container


Copyright © 2011. All Rights Reserved.