Palm API
Beta 2

com.sun.kjava
Class TextBox

java.lang.Object
  |
  +--com.sun.kjava.TextBox
Direct Known Subclasses:
ScrollTextBox

public class TextBox
extends java.lang.Object

A box displaying text on the screen. This class flows the text in the box. It doesn't break words, and therefore isn't graceful handling words larger than the width of the box.


Field Summary
protected  Graphics g
           
protected  int height
           
protected static int heightM
           
protected  IntVector lineEnds
           
protected  IntVector lineStarts
           
protected  java.lang.String text
           
protected  int width
           
protected static int widthM
           
protected  int xPos
           
protected  int yPos
           
 
Constructor Summary
TextBox()
          Create a new TextBox object.
TextBox(java.lang.String t, int x, int y, int w, int h)
          Create a new TextBox object.
 
Method Summary
 int getNumLines()
          How many lines of text does the TextBox currently hold?
 void paint()
          Paint the TextBox on the screen.
 void setBounds(int x, int y, int w, int h)
          Reset the display bounds of the TextBox.
 void setText(java.lang.String t)
          Set the text.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

protected java.lang.String text

lineStarts

protected IntVector lineStarts

lineEnds

protected IntVector lineEnds

xPos

protected int xPos

yPos

protected int yPos

width

protected int width

height

protected int height

g

protected Graphics g

widthM

protected static int widthM

heightM

protected static int heightM
Constructor Detail

TextBox

public TextBox()
Create a new TextBox object.

TextBox

public TextBox(java.lang.String t,
               int x,
               int y,
               int w,
               int h)
Create a new TextBox object.
Parameters:
t - the initial text
x - the X coordinate of the ScrollTextBox's position
y - the Y coordinate of the ScrollTextBox's position
w - the width
h - the height
Method Detail

getNumLines

public int getNumLines()
How many lines of text does the TextBox currently hold?
Returns:
the number of lines of text contained

setText

public void setText(java.lang.String t)
Set the text.
Parameters:
t - a String representing the new text.

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Reset the display bounds of the TextBox.
Parameters:
x - the new X coordinate of the ScrollTextBox's position
y - the new Y coordinate of the ScrollTextBox's position
w - the new width
h - the new height

paint

public void paint()
Paint the TextBox on the screen.

Submit a bug or feature

The GUI classes provided with this release are NOT part of CLDC, and they will be removed in later releases of this software. Official GUI classes for Java 2 Micro Edition will be defined separately through the Java Community Process and included in J2ME profiles. Java is trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc.
901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
All Rights Reserved.