com.sun.kjava
Class Dialog

java.lang.Object
  |
  +--com.sun.kjava.Spotlet
        |
        +--com.sun.kjava.Dialog

public class Dialog
extends Spotlet

A pop-up modal dialog that displays a title string, text box full of text, and a dismiss button.


Field Summary
protected  Button button
           
protected  Graphics g
           
protected  boolean haveScroll
           
protected  DialogOwner owner
           
protected  TextBox tb
           
protected  java.lang.String text
           
protected  java.lang.String title
           
 
Fields inherited from class com.sun.kjava.Spotlet
CALCICON, KEY_HARD1, KEY_HARD2, KEY_HARD3, KEY_HARD4, KEY_POWER, MENUICON, NO_EVENT_OPTIONS, PAGEDOWN, PAGEUP, WANT_SYSTEM_KEYS
 
Constructor Summary
Dialog(DialogOwner o, java.lang.String t, java.lang.String str, java.lang.String buttonText)
          Create a new Dialog of a fixed size.
 
Method Summary
 void dismissDialog()
          Dismiss the Dialog.
 void keyDown(int key)
          If we have a ScrollTextBox, then allow scrolling.
 void paint()
          Paint the Dialog.
 void penDown(int x, int y)
          If the user pressed the dismiss button, dismiss the Dialog.
 void penMove(int x, int y)
          If we have a ScrollTextBox, then allow scrolling.
 void showDialog()
          Show the Dialog: register it and paint it.
 
Methods inherited from class com.sun.kjava.Spotlet
beamReceive, beamSend, dispatch, getFlashID, penUp, register, setPalmEventOptions, unknownEvent, unregister
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

button

protected Button button

tb

protected TextBox tb

text

protected java.lang.String text

title

protected java.lang.String title

g

protected Graphics g

owner

protected DialogOwner owner

haveScroll

protected boolean haveScroll
Constructor Detail

Dialog

public Dialog(DialogOwner o,
              java.lang.String t,
              java.lang.String str,
              java.lang.String buttonText)
Create a new Dialog of a fixed size. Creates a TextBox 140x120 at position 10,10. The contents of the box is passed in the str parameter. A button is created which allows for dismissal of the Dialog. The text for the button is passed in buttonText. If the text overflows the text box, a ScrollTextBox is used to display it. The owner of the Dialog gets called through the DialogOwner interface dialogDismissed() method when the dialog is dismissed. The owner must then re-register the Spotlet that was running when the Dialog was created. It must also re-paint the screen as appropriate.
Parameters:
o - the owner of this Dialog
t - the title of this Dialog - used when the Dialog is dismissed
str - the contents of the TextBox
buttonText - the label of the button
Method Detail

paint

public void paint()
Paint the Dialog.

showDialog

public void showDialog()
Show the Dialog: register it and paint it.

dismissDialog

public void dismissDialog()
Dismiss the Dialog. Unregister it and alert the owner.

penDown

public void penDown(int x,
                    int y)
If the user pressed the dismiss button, dismiss the Dialog. If we have a ScrollTextBox, then allow scrolling.
Overrides:
penDown in class Spotlet
Parameters:
x - the X coordinate of the user's press.
y - the Y coordinate of the user's press.

penMove

public void penMove(int x,
                    int y)
If we have a ScrollTextBox, then allow scrolling.
Overrides:
penMove in class Spotlet
Parameters:
x - the X coordinate of the user's press.
y - the Y coordinate of the user's press.

keyDown

public void keyDown(int key)
If we have a ScrollTextBox, then allow scrolling.
Overrides:
keyDown in class Spotlet
Parameters:
key - the key pressed/entered by the user