Ascent Phase Corp.

org.ascentphase.suit
Class Field

java.lang.Object
  |
  +--org.ascentphase.suit.Widget
        |
        +--org.ascentphase.suit.Field

public class Field
extends Widget

A Field displays one or more rows of text that is underlined with a dotted line.

Version:
Author:
huyd

Field Summary
protected  java.lang.StringBuffer buffer
           
protected  int height
           
protected  int maxLength
           
protected  int rows
           
protected  int width
           
 
Fields inherited from class org.ascentphase.suit.Widget
cmdToThrow
 
Constructor Summary
Field(int rows, int width)
          Creates a Field with no text and an unlimited length.
Field(java.lang.String text, int rows, int width)
          Creates a Field with the given text and an unlimited length.
Field(java.lang.String text, int maxLen, int rows, int width)
          Creates a Field with the given text and the given maximum text length.
 
Method Summary
 void append(char c)
          Adds the given character to the Field text.
 void append(java.lang.String text)
          Adds the given String to the Field text.
 boolean contains(int x, int y)
          Returns whether the given coordinate lies within this widget's area of interest.
 java.lang.String getText()
           
 Command keyPressed(int keycode)
          Method called by the widget's containing Panel when a key is pressed and the widget has the Panel's focus.
 void paint(Graphics g)
          Draws the widget.
 void setText(java.lang.String text)
           
 
Methods inherited from class org.ascentphase.suit.Widget
getCommand, keyReleased, pointerDragged, pointerPressed, pointerReleased, setCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected java.lang.StringBuffer buffer

maxLength

protected int maxLength

rows

protected int rows

width

protected int width

height

protected int height
Constructor Detail

Field

public Field(int rows,
             int width)
Creates a Field with no text and an unlimited length.

Parameters:
rows - the number of rows of text.
width - the width of the field in pixels.

Field

public Field(java.lang.String text,
             int rows,
             int width)
Creates a Field with the given text and an unlimited length.

Parameters:
text - the initial String displayed in the Field.
rows - the number of rows of text.
width - the width of the field in pixels.

Field

public Field(java.lang.String text,
             int maxLen,
             int rows,
             int width)
Creates a Field with the given text and the given maximum text length.

Parameters:
text - the initial String displayed in the Field.
maxLen - the maximum length of the Field.
rows - the number of rows of text.
width - the width of the field in pixels.
Method Detail

append

public void append(char c)
Adds the given character to the Field text.

Parameters:
c - the character to add.

append

public void append(java.lang.String text)
Adds the given String to the Field text.

Parameters:
text - the String to add.

paint

public void paint(Graphics g)
Draws the widget.

Specified by:
paint in class Widget
Parameters:
g - the Graphics object to draw with.

contains

public boolean contains(int x,
                        int y)
Description copied from class: Widget
Returns whether the given coordinate lies within this widget's area of interest. The coordinate is relative to this widget's coordinate system. This method should return true if the coordinate given is of interest to the widget and the widget wishes to receive the keyXXX events and the pointerXXX events.

Overrides:
contains in class Widget
Parameters:
x - the x coordinate.
y - the y coordinate.

keyPressed

public Command keyPressed(int keycode)
Description copied from class: Widget
Method called by the widget's containing Panel when a key is pressed and the widget has the Panel's focus. By default, if this method is not over-ridden, it returns null to indicate no Command event.

Overrides:
keyPressed in class Widget
Parameters:
keycode - the keycode of key pressed.
Returns:
a Command event to notify any listeners, or null if none.

getText

public java.lang.String getText()

setText

public void setText(java.lang.String text)

Ascent Phase Corp.

Copyright © 2002 Ascent Phase Corp. All Rights Reserved.