com.jmex.bui
Class BTextArea

java.lang.Object
  extended by com.jmex.bui.BComponent
      extended by com.jmex.bui.BContainer
          extended by com.jmex.bui.BTextArea

public class BTextArea
extends BContainer

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 BTextArea.Line
          Contains the segments of text on a single line.
protected static class BTextArea.Run
          Used to associate a style with a run of text.
 
Nested classes/interfaces inherited from class com.jmex.bui.BContainer
BContainer.ChildOp
 
Field Summary
protected  com.jme.renderer.ColorRGBA[] _effcols
           
protected  int[] _effsizes
           
protected  HorizontalAlignment[] _haligns
           
protected  java.util.ArrayList<BTextArea.Line> _lines
           
protected  BoundedRangeModel _model
           
protected  int _prefWidth
           
protected  java.util.ArrayList<BTextArea.Run> _runs
           
protected  TextEffect[] _teffects
           
protected  BTextFactory[] _textfacts
           
protected  VerticalAlignment[] _valigns
           
static int BOLD
          A font style constant.
static int ITALIC
          A font style constant.
static int PLAIN
          A font style constant.
static int UNDERLINE
          A font style constant.
 
Fields inherited from class com.jmex.bui.BContainer
_children, _layout
 
Fields inherited from class com.jmex.bui.BComponent
_alpha, _backgrounds, _bbuf, _borders, _colors, _cursor, _enabled, _height, _hover, _insets, _listeners, _parent, _preferredSize, _properties, _styleClass, _tipmouse, _tipStyle, _tiptext, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Constructor Summary
BTextArea()
          Constructor
BTextArea(java.lang.String text)
          Constructor
 
Method Summary
 void appendText(java.lang.String text)
          Appends text with the foreground color in the plain style.
 void appendText(java.lang.String text, com.jme.renderer.ColorRGBA color)
          Appends text with the specified color in the plain style.
 void appendText(java.lang.String text, com.jme.renderer.ColorRGBA color, int style)
          Appends text with the specified color and style.
 void appendText(java.lang.String text, int style)
          Appends text with the foreground color in the specified style.
protected  int[] checkNonDefault(int[] styles, int defval)
           
protected  HorizontalAlignment[] checkNonDefaultHorizontalAlignment(HorizontalAlignment[] styles)
           
protected  TextEffect[] checkNonDefaultTextEffect(TextEffect[] styles)
           
protected  VerticalAlignment[] checkNonDefaultVerticalAlignment(VerticalAlignment[] styles)
           
 void clearText()
          Clears out the text displayed in this area.
protected  Dimension computePreferredSize(int whint, int hhint)
          documentation inherited
protected  void configureStyle(BStyleSheet style)
          documentation inherited
protected  java.lang.String getDefaultStyleClass()
          from BTextArea
 com.jme.renderer.ColorRGBA getEffectColor()
          Returns the color to use for our text effect.
 int getEffectSize()
          Returns the effect size for this component's text.
 HorizontalAlignment 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.
 TextEffect getTextEffect()
          Returns the effect for this component's text.
 BTextFactory getTextFactory()
          Returns a text factory suitable for creating text in the style defined by the component's current state.
 VerticalAlignment getVerticalAlignment()
          Returns the vertical alignment for this component's text.
protected  void layout()
          documentation inherited
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(com.jme.renderer.Renderer renderer)
          documentation inherited
 void scrollToLine(int line)
          Scrolls our display such that the sepecified line is visible.
 void setEnabled(boolean enabled)
          from BTextArea
 void setPreferredWidth(int width)
          Configures the preferred width of this text area (the preferred height will be calculated from the font).
 void setText(java.lang.String text)
          Clears any text in this text area and appends the supplied text.
protected  void wasAdded()
          from BTextArea
protected  void wasRemoved()
          documentation inherited
 
Methods inherited from class com.jmex.bui.BContainer
add, add, add, add, applyOperation, getComponent, getComponentCount, getComponentIndex, getHitComponent, getLayoutManager, getNextFocus, getPreviousFocus, remove, remove, removeAll, replace, setAlpha, setLayoutManager, setVisible, validate
 
Methods inherited from class com.jmex.bui.BComponent
acceptsFocus, addListener, addListeners, applyDefaultStates, boundsToString, changeCursor, createTooltipComponent, dispatchEvent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getCursor, getFocusTarget, getHeight, getInsets, getLocation, getName, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleClass, getTooltipText, getWidth, getWindow, getX, getY, hasFocus, intersectScissorBox, invalidate, isAdded, isConsumeMouseEvents, isEnabled, isHoverEnabled, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, restoreScissorState, setBackground, setBounds, setConsumeMouseEvents, setCursor, setHoverEnabled, setLocation, setName, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleClass, setTooltipRelativeToMouse, setTooltipText, stateDidChange, updateCursor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

UNDERLINE

public static final int UNDERLINE
A font style constant.

See Also:
Constant Field Values

_haligns

protected HorizontalAlignment[] _haligns

_valigns

protected VerticalAlignment[] _valigns

_teffects

protected TextEffect[] _teffects

_effsizes

protected int[] _effsizes

_effcols

protected com.jme.renderer.ColorRGBA[] _effcols

_textfacts

protected BTextFactory[] _textfacts

_model

protected BoundedRangeModel _model

_prefWidth

protected int _prefWidth

_runs

protected java.util.ArrayList<BTextArea.Run> _runs

_lines

protected java.util.ArrayList<BTextArea.Line> _lines
Constructor Detail

BTextArea

public BTextArea()
Constructor


BTextArea

public BTextArea(java.lang.String text)
Constructor

Parameters:
text - String
Method Detail

getHorizontalAlignment

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

Returns:
BConstants

getVerticalAlignment

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

Returns:
BConstants

setPreferredWidth

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

Parameters:
width - int

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.

Returns:
BoundedRangeModel

setText

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

Parameters:
text - String

appendText

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

Parameters:
text - String

appendText

public void appendText(java.lang.String text,
                       com.jme.renderer.ColorRGBA color)
Appends text with the specified color in the plain style.

Parameters:
text - String
color - ColorRGBA

appendText

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

Parameters:
text - String
style - int

appendText

public void appendText(java.lang.String text,
                       com.jme.renderer.ColorRGBA color,
                       int style)
Appends text with the specified color and style.

Parameters:
text - String
color - ColorRGBA
style - int

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.

Parameters:
line - int

getLineCount

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

Returns:
int

getTextFactory

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

Returns:
BTextFactory

getTextEffect

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

Returns:
BConstants

getEffectSize

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

Returns:
BConstants

getEffectColor

public com.jme.renderer.ColorRGBA getEffectColor()
Returns the color to use for our text effect.

Returns:
ColorRGBA

setEnabled

public void setEnabled(boolean enabled)
from BTextArea

Overrides:
setEnabled in class BContainer
Parameters:
enabled - boolean
See Also:
BContainer.setEnabled(boolean)

getDefaultStyleClass

protected java.lang.String getDefaultStyleClass()
from BTextArea

Overrides:
getDefaultStyleClass in class BContainer
Returns:
String
See Also:
BContainer.getDefaultStyleClass()

wasAdded

protected void wasAdded()
from BTextArea

Overrides:
wasAdded in class BContainer
See Also:
BContainer.wasAdded()

wasRemoved

protected void wasRemoved()
documentation inherited

Overrides:
wasRemoved in class BContainer
See Also:
BContainer.wasRemoved()

configureStyle

protected void configureStyle(BStyleSheet style)
documentation inherited

Overrides:
configureStyle in class BComponent
Parameters:
style - BStyleSheet
See Also:
BComponent.configureStyle(com.jmex.bui.BStyleSheet)

checkNonDefaultHorizontalAlignment

protected HorizontalAlignment[] checkNonDefaultHorizontalAlignment(HorizontalAlignment[] styles)

checkNonDefaultVerticalAlignment

protected VerticalAlignment[] checkNonDefaultVerticalAlignment(VerticalAlignment[] styles)

checkNonDefaultTextEffect

protected TextEffect[] checkNonDefaultTextEffect(TextEffect[] styles)

checkNonDefault

protected int[] checkNonDefault(int[] styles,
                                int defval)
Parameters:
styles - int[]
Returns:
int[]

layout

protected void layout()
documentation inherited

Overrides:
layout in class BContainer
See Also:
BContainer.layout()

renderComponent

protected void renderComponent(com.jme.renderer.Renderer renderer)
documentation inherited

Overrides:
renderComponent in class BContainer
Parameters:
renderer - Renderer
See Also:
BContainer.renderComponent(com.jme.renderer.Renderer)

computePreferredSize

protected Dimension computePreferredSize(int whint,
                                         int hhint)
documentation inherited

Overrides:
computePreferredSize in class BContainer
Parameters:
whint - int
hhint - int
Returns:
Dimension
See Also:
BContainer.computePreferredSize(int, int)

refigureContents

protected void refigureContents(int width)
Reflows the entirety of our text.

Parameters:
width - int

modelDidChange

protected void modelDidChange()
Called when our model has changed (due to scrolling by a scroll bar or a call to scrollToLine(int), etc.).



Copyright © 2011 Michael Bayne. All Rights Reserved.