de.rico.engine.effect.ortho
Class TextAreaRenderer

java.lang.Object
  extended by de.rico.engine.effect.ortho.TextAreaRenderer

public class TextAreaRenderer
extends java.lang.Object

This class can be used to draw a rectangular area that can contain some text. The text gets line wrapped automatically.

Author:
Frank Bruns

Constructor Summary
TextAreaRenderer(int x, int y, int width, int spacing, int margin, Color4f txtCol, Color4f bgCol)
          Creates a new text area with the specified parameters.
TextAreaRenderer(int x, int y, int width, int spacing, int margin, Color4f txtCol, Color4f bgCol, Font font)
          Creates a new list menu with the specified parameters.
 
Method Summary
 void add(java.lang.String text)
          Adds (appends) further text to the area.
 void clear()
          Clears the text from the text area.
 void draw()
          Draws the text area and its current text.
 java.lang.String getText()
          Returns the text from the text area.
 TextRenderer getTextRenderer()
          Returns the text renderer object that is used for this text area to display the text.
 void setBGImage(OverlayImage img, float alpha)
          Sets a background image to the list menu.
 void setText(java.lang.String text)
          Sets the specified text to the text area.
 void setVisible(boolean visible)
          Sets whether or not the list menu ought to be visible.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextAreaRenderer

public TextAreaRenderer(int x,
                        int y,
                        int width,
                        int spacing,
                        int margin,
                        Color4f txtCol,
                        Color4f bgCol)
Creates a new text area with the specified parameters. The height of the area will adapt to the space that is required by its text.

Parameters:
x - x-coordinate of upper left corner
y - y-coordinate of upper left corner
width - designated width of the text area
spacing - vertical spacing (gap size) between the lines
txtCol - text color
bgCol - background color of the text area

TextAreaRenderer

public TextAreaRenderer(int x,
                        int y,
                        int width,
                        int spacing,
                        int margin,
                        Color4f txtCol,
                        Color4f bgCol,
                        Font font)
Creates a new list menu with the specified parameters. The width and height of the menu area will adapt to the space that is required by its entries.

Parameters:
x - x-coordinate of upper left corner
y - y-coordinate of upper left corner
spacing - vertical spacing (gap size) between the entries
txtCol - text color for the menu entries
bgCol - background color of the menu
font - font from the Font enumeration class
Method Detail

setBGImage

public void setBGImage(OverlayImage img,
                       float alpha)
Sets a background image to the list menu.

Parameters:
img - overlay image that ought to be used as a background image.
alpha - alpha value [0..1] for transparency

add

public void add(java.lang.String text)
Adds (appends) further text to the area.

Parameters:
text - text to append

setText

public void setText(java.lang.String text)
Sets the specified text to the text area. Previous text will be replaced.

Parameters:
text - text to set to the text area

getText

public java.lang.String getText()
Returns the text from the text area.

Returns:
text from the text area

clear

public void clear()
Clears the text from the text area.


setVisible

public void setVisible(boolean visible)
Sets whether or not the list menu ought to be visible.

Parameters:
visible - set visible? --> true=yes, false=no

getTextRenderer

public TextRenderer getTextRenderer()
Returns the text renderer object that is used for this text area to display the text.

Returns:
text renderer of this text area.

draw

public void draw()
Draws the text area and its current text.