|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.gui.Component
com.threerings.opengl.gui.Container
com.threerings.opengl.gui.TextArea
public class TextArea
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.
| Nested Class Summary | |
|---|---|
protected static class |
TextArea.Line
Contains the segments of text on a single line. |
protected static class |
TextArea.Run
Used to associate a style with a run of text. |
| Nested classes/interfaces inherited from class com.threerings.opengl.gui.Container |
|---|
Container.ChildOp |
| Field Summary | |
|---|---|
protected Color4f[] |
_effcols
|
protected int[] |
_effsizes
|
protected int[] |
_haligns
|
protected ArrayList<TextArea.Line> |
_lines
|
protected BoundedRangeModel |
_model
|
protected int |
_prefWidth
|
protected ArrayList<TextArea.Run> |
_runs
|
protected int[] |
_teffects
|
protected TextFactory[][] |
_textfacts
|
protected int[] |
_valigns
|
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.Container |
|---|
_children, _layout |
| Fields inherited from class com.threerings.opengl.gui.Component |
|---|
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES |
| 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. |
protected Dimension |
computePreferredSize(int whint,
int hhint)
Computes and returns a preferred size for this component. |
protected String |
getDefaultStyleConfig()
Returns the name of the default config to be used for all instances of this component. |
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. |
protected void |
layout()
Instructs this component to lay itself out. |
protected void |
modelDidChange()
Called when our model has changed (due to scrolling by a scroll bar or a call to scrollToLine(int), etc.). |
protected void |
refigureContents(int width)
Reflows the entirety of our text. |
protected void |
renderComponent(Renderer renderer)
Renders any custom bits for this component. |
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. |
protected void |
updateFromStyleConfig(int state,
StyleConfig.Original config)
Updates from the resolved style config. |
| Methods inherited from class com.threerings.opengl.gui.Container |
|---|
add, add, add, add, applyOperation, getComponent, getComponentCount, getComponentIndex, getFirstDescendantFocus, getHitComponent, getLastDescendantFocus, getLayoutManager, getNextFocus, getPreviousFocus, remove, remove, removeAll, replace, setAlpha, setHoverable, setLayoutManager, validate, wasAdded, wasRemoved |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PLAIN
public static final int BOLD
public static final int ITALIC
protected int[] _haligns
protected int[] _valigns
protected int[] _teffects
protected int[] _effsizes
protected Color4f[] _effcols
protected TextFactory[][] _textfacts
protected BoundedRangeModel _model
protected int _prefWidth
protected ArrayList<TextArea.Run> _runs
protected ArrayList<TextArea.Line> _lines
| Constructor Detail |
|---|
public TextArea(GlContext ctx)
public TextArea(GlContext ctx,
String text)
| Method Detail |
|---|
public int getHorizontalAlignment()
public int getVerticalAlignment()
public void setPreferredWidth(int width)
public BoundedRangeModel getScrollModel()
public void setText(String text)
public void appendText(String text)
public void appendText(String text,
Color4f color)
public void appendText(String text,
int style)
public void appendText(String text,
Color4f color,
int style)
public void clearText()
public void scrollToLine(int line)
public int getLineCount()
public TextFactory getTextFactory()
public TextFactory getTextFactory(int style)
public int getTextEffect()
public int getEffectSize()
public Color4f getEffectColor()
public void setEnabled(boolean enabled)
Component
setEnabled in class Containerprotected String getDefaultStyleConfig()
Component
getDefaultStyleConfig in class Container
protected void updateFromStyleConfig(int state,
StyleConfig.Original config)
Component
updateFromStyleConfig in class Componentprotected void layout()
Component
layout in class Containerprotected void renderComponent(Renderer renderer)
Component
renderComponent in class Container
protected Dimension computePreferredSize(int whint,
int hhint)
Component
computePreferredSize in class Containerprotected void refigureContents(int width)
protected void modelDidChange()
scrollToLine(int), etc.).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||