jcontrol.ui.vole
Class TextArea

java.lang.Object
  |
  +--jcontrol.ui.vole.Component
        |
        +--jcontrol.ui.vole.TextArea

public class TextArea
extends Component

This class TextArea.class implements a text area for JControl's VOLE user interface. The text can be scrolled, rows can be added, inserted and deleted.

Version:
1.1
Author:
Marcus Timmermann, Wolfgang Klingauf
See Also:
ScrollBar

Field Summary
static int DOWN
          Scroll down
protected  int fontheight
           
protected  int lastDirection
           
static boolean NO
          Scrollbar - no
protected  int oldScrollBarValue
           
protected  boolean scrollbar
           
protected  int scrollBarValue
           
protected  int scrollValue
           
protected  java.util.Vector textData
           
protected  int textheight
           
static int UP
          Scroll up
static boolean YES
          Scrollbar - yes
 
Fields inherited from class jcontrol.ui.vole.Component
focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
TextArea()
          Creates a new empty TextArea without a scroll bar.
TextArea(int x, int y, int width, int height, boolean scrollbar)
          Constructor for TextArea.
TextArea(java.lang.String[] text, int x, int y, int width, int height, boolean scrollbar)
          Constructor for TextArea.
 
Method Summary
 void add(java.lang.String text)
          Add a row to the end of the text field.
 void insert(int row, java.lang.String text)
          Insert a row of text in the text field.
 boolean onKeyEvent(KeyEvent e)
          Handle KeyEvents.
 void paint()
          Redraws this text field.
 void paintScrollbar()
          Paint the ScrollBar.
 void remove()
          Remove the text field.
 void remove(int row)
          Removes a row from the text field.
 void scroll(int about, int direction)
          Scrolls the text.
 void setActionListener(ActionListener listener)
          Add an ActionListener to the button.
 void setScrollPos(int pos)
          Sets the absolute scroll position of the text area.
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, removeFocus, requestFocus, setBounds, setFont, setGraphics, setLocation, setParent, setVisible, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, notifyAll, wait
 

Field Detail

DOWN

public static final int DOWN
Scroll down

See Also:
Constant Field Values

fontheight

protected int fontheight

lastDirection

protected int lastDirection

NO

public static final boolean NO
Scrollbar - no

See Also:
Constant Field Values

oldScrollBarValue

protected int oldScrollBarValue

scrollbar

protected boolean scrollbar

scrollBarValue

protected int scrollBarValue

scrollValue

protected int scrollValue

textData

protected java.util.Vector textData

textheight

protected int textheight

UP

public static final int UP
Scroll up

See Also:
Constant Field Values

YES

public static final boolean YES
Scrollbar - yes

See Also:
Constant Field Values
Constructor Detail

TextArea

public TextArea()
Creates a new empty TextArea without a scroll bar.


TextArea

public TextArea(int x,
                int y,
                int width,
                int height,
                boolean scrollbar)
Constructor for TextArea.

Parameters:
x - The x coordinate on the display.
y - The y coordinate on the display.
width - The text field width.
height - The tet field height.
scrollbar - Select whether a scrollbar should be displayed.

TextArea

public TextArea(java.lang.String[] text,
                int x,
                int y,
                int width,
                int height,
                boolean scrollbar)
Constructor for TextArea.

Parameters:
x - The x coordinate on the display.
y - The y coordinate on the display.
width - The text field width.
height - The text field height.
text - The text as String array.
scrollbar - Select whether a scrollbar should be displayed.
Method Detail

add

public void add(java.lang.String text)
Add a row to the end of the text field. The text is scrolled to the new row.

Parameters:
text - The text to add.

insert

public void insert(int row,
                   java.lang.String text)
Insert a row of text in the text field. The following rows are shifted down.

Parameters:
row - The row to insert.
text - The text for the row.

onKeyEvent

public boolean onKeyEvent(KeyEvent e)
Handle KeyEvents.

Overrides:
onKeyEvent in class Component
Parameters:
e - the KeyEvent
Returns:
If this method returns true, the KeyEvent is handled by the super Container.

paint

public void paint()
Redraws this text field.

Overrides:
paint in class Component
See Also:
Component

paintScrollbar

public void paintScrollbar()
Paint the ScrollBar.


remove

public void remove()
Remove the text field.

Overrides:
remove in class Component
See Also:
Component

remove

public void remove(int row)
Removes a row from the text field. The following rows are shifted up.

Parameters:
row - The row to remove.

scroll

public void scroll(int about,
                   int direction)
Scrolls the text.

Parameters:
about - the amount the text has to be scrolled.
direction - UP or DOWN

setActionListener

public void setActionListener(ActionListener listener)
Add an ActionListener to the button. It will receive ActionEvents when the button is pressed.

Parameters:
listener - The new ActionListener or null.

setScrollPos

public void setScrollPos(int pos)
Sets the absolute scroll position of the text area.

Parameters:
pos - The new scroll position.