jcontrol.ui.vole
Class TextArea

java.lang.Object
  extended by jcontrol.ui.vole.Component
      extended by 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.

(c) Copyright 2003-2007 DOMOLOGIC GmbH

See Also:
ScrollBar

Field Summary
static int SCROLL_DOWN
          Scroll down
static int SCROLL_UP
          Scroll up
 
Fields inherited from class jcontrol.ui.vole.Component
eventQueue, 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 showScrollbar)
          Constructor for TextArea.
TextArea(String[] items, int x, int y, int width, int height, boolean showScrollbar)
          Constructor for TextArea.
 
Method Summary
 void add(String item)
          Add a row to the end of the text field.
 void insert(int row, String item)
          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(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, remove, removeFocus, requestFocus, setBounds, setFont, setGraphics, setParent, setVisible, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

SCROLL_UP

public static final int SCROLL_UP
Scroll up

See Also:
Constant Field Values

SCROLL_DOWN

public static final int SCROLL_DOWN
Scroll down

See Also:
Constant Field Values
Constructor Detail

TextArea

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


TextArea

public TextArea(String[] items,
                int x,
                int y,
                int width,
                int height,
                boolean showScrollbar)
Constructor for TextArea.

Parameters:
items - The text as String array.
x - The x coordinate on the display.
y - The y coordinate on the display.
width - The text field width.
height - The text field height.
showScrollbar - Selects whether a scrollbar should be displayed or not.

TextArea

public TextArea(int x,
                int y,
                int width,
                int height,
                boolean showScrollbar)
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.
showScrollbar - Selects whether a scrollbar should be displayed or not.
Method Detail

insert

public void insert(int row,
                   String item)
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.

add

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

Parameters:
item - The text to add.

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.

setScrollPos

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

Parameters:
pos - The new scroll position.

scroll

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

Parameters:
about - the amount the text has to be scrolled.
direction - SCROLL_UP or SCROLL_DOWN

paint

public void paint()
Redraws this text field.

Overrides:
paint in class Component
See Also:
Component

paintScrollbar

public void paintScrollbar()
Paint the ScrollBar.


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.

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.