net.slashie.libjcsi.textcomponents
Class TextComponent

java.lang.Object
  extended by net.slashie.libjcsi.textcomponents.TextComponent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ListBox, MenuBox, TextBox, TextInformBox

public abstract class TextComponent
extends java.lang.Object
implements java.io.Serializable

Basic framework for all text components.

Author:
Santiago Zapata, Eben Howard
See Also:
Serialized Form

Constructor Summary
TextComponent(ConsoleSystemInterface si)
          Creates a new TextComponent within the specified interface.
 
Method Summary
 void clearBox()
          Erases content of the component, but leaves component.
abstract  void draw()
          Prints the componenet to the interface.
 void drawBorder()
          If there is supposed to be a border then draws a border, otherwise returns without doing anything.
 int getForeColor()
           
 int getHeight()
           
 int getWidth()
           
 boolean hasBorder()
           
 void setBorder(boolean value)
          Allows for setting whether there should be a border.
 void setBorderColor(CSIColor color)
          Allows for the setting of the border's color independently of the content's color.
 void setBorderColor(int color)
          Allows for the setting of the border's color independently of the content's color.
 void setBounds(int x, int y, int width, int height)
          Allows for setting the upper left corner and width and height in one method.
 void setForeColor(CSIColor color)
          Allows for setting of the color using CSIColor.
 void setForeColor(int color)
          Allows for setting of the color using int codes.
 void setHeight(int value)
           
 void setPosition(int x, int y)
          Sets the upper left corner of text component within its interface.
 void setWidth(int value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextComponent

public TextComponent(ConsoleSystemInterface si)
Creates a new TextComponent within the specified interface.

Parameters:
si - interface to be created within
Method Detail

setPosition

public void setPosition(int x,
                        int y)
Sets the upper left corner of text component within its interface.

Parameters:
x - horizontal position
y - vertical position

getWidth

public int getWidth()
Returns:
horizontal width of the component

setWidth

public void setWidth(int value)
Parameters:
value - how wide the componenet should be.

getHeight

public int getHeight()
Returns:
vertical height of the component

setHeight

public void setHeight(int value)
Parameters:
value - the desired height of the component

draw

public abstract void draw()
Prints the componenet to the interface.


getForeColor

public int getForeColor()
Returns:
the code for the color in the foreground

setForeColor

public void setForeColor(int color)
Allows for setting of the color using int codes.

Parameters:
color - int code for color desired

setForeColor

public void setForeColor(CSIColor color)
Allows for setting of the color using CSIColor.

Parameters:
color - color desired

setBorder

public void setBorder(boolean value)
Allows for setting whether there should be a border.

Parameters:
value - true if border desired

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Allows for setting the upper left corner and width and height in one method.

Parameters:
x - horizontal starting point
y - vertical starting point
width - horizontal width
height - vertical height

clearBox

public void clearBox()
Erases content of the component, but leaves component.


hasBorder

public boolean hasBorder()
Returns:
true if there is a border

drawBorder

public void drawBorder()
If there is supposed to be a border then draws a border, otherwise returns without doing anything.


setBorderColor

public void setBorderColor(int color)
Allows for the setting of the border's color independently of the content's color.

Parameters:
color - the int code for the color desired

setBorderColor

public void setBorderColor(CSIColor color)
Allows for the setting of the border's color independently of the content's color.

Parameters:
color - color desired