monrovia.client.ui
Class BasicScrollTextBox

java.lang.Object
  |
  +--com.sun.kjava.TextBox
        |
        +--monrovia.client.ui.BasicScrollTextBox
All Implemented Interfaces:
com.sun.kjava.ScrollOwner

public class BasicScrollTextBox
extends com.sun.kjava.TextBox
implements com.sun.kjava.ScrollOwner

A scrolling TextBox object. This is basically the com.sun.kjava.ScrollTextBox object with the bugs ironed out. I was unable to subclass ScrollTextBox and still get access to the bugs, so this is my interim solution. 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.


Field Summary
protected  int curVal
           
protected  int maxVal
           
protected  int minVal
           
protected  int numLines
           
protected  java.lang.StringBuffer textBuffer
           
protected  int visibleLines
           
protected  com.sun.kjava.VerticalScrollBar vsb
           
 
Fields inherited from class com.sun.kjava.TextBox
g, height, heightM, lineEnds, lineStarts, text, width, widthM, xPos, yPos
 
Constructor Summary
protected BasicScrollTextBox()
           
  BasicScrollTextBox(java.lang.String t, int x, int y, int w, int h)
          Create a new ScrollTextBox2 object.
 
Method Summary
 void addText(java.lang.String t)
          Add new text to the end of the text box.
 boolean contains(int x, int y)
          Is this point inside the bounds of the object?
 java.lang.String getText()
           
 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(boolean pForce)
          Paint the ScrollTextBox2.
 void setBounds(int x, int y, int w, int h)
          Reset the display bounds of the ScrollTextBox2.
 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, paint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textBuffer

protected java.lang.StringBuffer textBuffer

vsb

protected com.sun.kjava.VerticalScrollBar vsb

minVal

protected int minVal

maxVal

protected int maxVal

curVal

protected int curVal

visibleLines

protected int visibleLines

numLines

protected int numLines
Constructor Detail

BasicScrollTextBox

protected BasicScrollTextBox()

BasicScrollTextBox

public BasicScrollTextBox(java.lang.String t,
                          int x,
                          int y,
                          int w,
                          int h)
Create a new ScrollTextBox2 object.
Parameters:
t - the initial text
x - the X coordinate of the ScrollTextBox2's position
y - the Y coordinate of the ScrollTextBox2'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 ScrollTextBox2.
Overrides:
setBounds in class com.sun.kjava.TextBox
Parameters:
x - the new X coordinate of the ScrollTextBox2's position
y - the new Y coordinate of the ScrollTextBox2's position
w - the new width
h - the new height

getText

public java.lang.String getText()

setText

public void setText(java.lang.String t)
Set the text.
Overrides:
setText in class com.sun.kjava.TextBox
Parameters:
t - a String representing the new text.

addText

public void addText(java.lang.String t)
Add new text to the end of the text box.
Parameters:
t - a String representing the new text.

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

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

paint

public void paint(boolean pForce)
Paint the ScrollTextBox2.
Parameters:
pForce - true if we want to paint even if nothing was changed, false otherwise

setScrollValue

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