jewl
Class TextControl

java.lang.Object
  extended byjewl.Window
      extended byjewl.Control
          extended byjewl.TextControl
Direct Known Subclasses:
BooleanControl, Button, Label, Menu, TextField

public abstract class TextControl
extends Control

The abstract base class for controls which contain a text string. Any such control provides methods for getting and setting the text that the control contains,as well as controlling the text alignment within the control (left justified, right justified or centred).


Field Summary
static int CENTER
          Used for centred text.
static int CENTRE
          Used for centred text, using British spelling.
static int LEFT
          Used for left-aligned text.
static int RIGHT
          Used for right-aligned text.
 
Method Summary
 int getAlignment()
          Get the alignment of this control's text within its allocated area.
 java.lang.String getText()
          Get the text displayed by the control.
 void setAlignment(int align)
          Set the alignment of this control's text within its allocated area.
 void setKey(char key)
          Set a mnemonic key.
 void setText(java.lang.String text)
          Set the text displayed by the control.
 
Methods inherited from class jewl.Control
disable, enable, enable, getToolTip, isEnabled, setToolTip
 
Methods inherited from class jewl.Window
addEventListener, commandAvailable, getCommand, getFont, getHeight, getID, getLeft, getScreenHeight, getScreenWidth, getSource, getTop, getWidth, hide, init, isVisible, nextCommand, parent, root, setFont, setID, setLocation, setSize, show, show
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Used for left-aligned text.

See Also:
Constant Field Values

CENTRE

public static final int CENTRE
Used for centred text, using British spelling.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Used for centred text.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Used for right-aligned text.

See Also:
Constant Field Values
Method Detail

setAlignment

public void setAlignment(int align)
Set the alignment of this control's text within its allocated area.

Parameters:
align - the desired alignment, specified using one of the values LEFT, RIGHT, CENTRE or CENTER.

getAlignment

public int getAlignment()
Get the alignment of this control's text within its allocated area.

Returns:
The current alignment, which will be one of the values LEFT, RIGHT, CENTRE or CENTER.

setText

public void setText(java.lang.String text)
Set the text displayed by the control.

Parameters:
text - the text for the control to display.

getText

public java.lang.String getText()
Get the text displayed by the control.

Returns:
The current text displayed by the control.

setKey

public void setKey(char key)
Set a mnemonic key. The possible mnemonics are Alt-A to Alt-Z, and Alt-0 to Alt-9. Pressing the designated key will have the same effect as clicking on the control with the mouse. The first occurrence of the letter or digit in the text displayed on the button will be underlined as a visual reminder of the mnemonic.

Parameters:
key - a letter or digit which will activate the button when pressed together with the Alt key. Anything other than a letter or digit will be ignored.