com.sun.kjava
Class ScrollTextBox

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

public class ScrollTextBox
extends TextBox
implements ScrollOwner

A scrolling TextBox object. You need to control this class from a registered Spotlet. In the Spotlet class, implement penDown(), penMove() and keyDown() to call the handlePenDown(), handlePenMove() and handleKeyDown() methods of this class.


Fields inherited from class com.sun.kjava.TextBox
g, height, heightM, lineEnds, lineStarts, text, width, widthM, xPos, yPos
 
Constructor Summary
protected ScrollTextBox()
           
  ScrollTextBox(java.lang.String t, int x, int y, int w, int h)
          Create a new ScrollTextBox object.
 
Method Summary
 boolean contains(int x, int y)
          Is this point inside the bounds of the object?
 void handleKeyDown(int keyCode)
          The user pressed a key.
 void handlePenDown(int x, int y)
          The pen has gone down at (x, y).
 void handlePenMove(int x, int y)
          The pen has moved at (x, y).
protected  void init()
          Initialize the object.
 void paint()
          Paint the ScrollTextBox.
 void setBounds(int x, int y, int w, int h)
          Reset the display bounds of the ScrollTextBox.
 void setScrollValue(int val)
          Set the current scroll value and repaint.
 void setText(java.lang.String t)
          Set the text.
 
Methods inherited from class com.sun.kjava.TextBox
getNumLines
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScrollTextBox

protected ScrollTextBox()

ScrollTextBox

public ScrollTextBox(java.lang.String t,
                     int x,
                     int y,
                     int w,
                     int h)
Create a new ScrollTextBox 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

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Reset the display bounds of the ScrollTextBox.
Overrides:
setBounds in class 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

setText

public void setText(java.lang.String t)
Set the text. You need to call paint() on the ScrollTextBox to get the new text/scrollbar to display.
Overrides:
setText in class TextBox
Parameters:
t - a String representing the new text.

init

protected void init()
Initialize the object.

contains

public boolean contains(int x,
                        int y)
Is this point inside the bounds of the object?
Parameters:
x - the X coordinate of the position to test
y - the Y coordinate of the position to test
Returns:
true of the point is inside our bounds

handlePenDown

public void handlePenDown(int x,
                          int y)
The pen has gone down at (x, y). Do the right thing.
Parameters:
x - the X coordinate of the pen position
y - the Y coordinate of the pen position

handlePenMove

public void handlePenMove(int x,
                          int y)
The pen has moved at (x, y). Do the right thing.
Parameters:
x - the X coordinate of the pen position
y - the Y coordinate of the pen position

handleKeyDown

public void handleKeyDown(int keyCode)
The user pressed a key. Do the right thing.
Parameters:
keyCode - a code representing the key the user pressed

paint

public void paint()
Paint the ScrollTextBox.
Overrides:
paint in class TextBox

setScrollValue

public void setScrollValue(int val)
Set the current scroll value and repaint.
Specified by:
setScrollValue in interface ScrollOwner
Parameters:
val - the new scroll value.