waba.ui
Class MessageBox

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Container
              |
              +--waba.ui.Window
                    |
                    +--waba.ui.MessageBox

public class MessageBox
extends Window

this class implements a scrollable message box window with customized buttons, delayed unpop and scroll text.
for example, to create an automatic unpop after 5 seconds, do:

MessageBox mb = new MessageBox("SuperWaba","SuperWaba is an enhanced version|of the Waba Virtual Machine.|Programmed by:|Guilherme Campos Hazan",null);               
mb.setUnpopDelay(5000);
popupModal(mb);
created by guich@SuperWaba_1.1


Fields inherited from class waba.ui.Window
_controlEvent, _g, _keyEvent, _penEvent, beepIfOut, flicker, gbuf, HIDE_STATE, imgBuf, needsPaint, NO_BORDER, RECT_BORDER, ROUND_BORDER, style, TAB_BORDER, TAB_ONLY_BORDER, title, titleFont
 
Fields inherited from class waba.ui.Container
children, tail
 
Fields inherited from class waba.ui.Control
BOTTOM, CENTER, controlCount, enabled, FILL, fm, font, height, LEFT, name, next, parent, PREFERRED, prev, RIGHT, TOP, width, x, y
 
Constructor Summary
MessageBox(java.lang.String title, java.lang.String msg)
          constructs a message box with the text and one "Ok" button
MessageBox(java.lang.String title, java.lang.String text, java.lang.String[] buttonCaptions)
          constructs a message box with the text and the specified button captions. the text may be separated by '|' as the line delimiters. if buttonCaptions is null, no buttons are displayed and you must dismiss the dialog by calling unpop or by setting the delay using setUnpopDelay method
 
Method Summary
 int getPressedButtonIndex()
          returns the pressed button index
 void onEvent(Event e)
          handle scroll buttons and normal buttons
 void onPaint(Graphics g)
          Called to draw the control.
 void setUnpopDelay(int unpopDelay)
          sets a delay for the unpop of this dialog
 
Methods inherited from class waba.ui.Window
_doPaint, _doPaint, _postEvent, damageRect, getClientRect, getFocus, getTopMost, isTopMost, isVisible, onClickedOutside, onPopup, onUnpop, paintTitle, popupModal, postPopup, postUnpop, setBorderStyle, setDoubleBuffer, setFocus, setStatePosition, setTitle, setTitleFont, setVisible, toString, unpop
 
Methods inherited from class waba.ui.Container
add, findChild, paintChildren, remove
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getAbsoluteRect, getFontMetrics, getNext, getParent, getPreferredHeight, getPreferredWidth, getRect, isEnabled, onBoundsChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, setEnabled, setFont, setRect, setRect
 
Methods inherited from class java.lang.Object
hashCode
 

Constructor Detail

MessageBox

public MessageBox(java.lang.String title,
                  java.lang.String msg)
constructs a message box with the text and one "Ok" button

MessageBox

public MessageBox(java.lang.String title,
                  java.lang.String text,
                  java.lang.String[] buttonCaptions)
constructs a message box with the text and the specified button captions. the text may be separated by '|' as the line delimiters. if buttonCaptions is null, no buttons are displayed and you must dismiss the dialog by calling unpop or by setting the delay using setUnpopDelay method
Method Detail

setUnpopDelay

public void setUnpopDelay(int unpopDelay)
sets a delay for the unpop of this dialog

onPaint

public void onPaint(Graphics g)
Description copied from class: Control
Called to draw the control. When this method is called, the graphics object passed has been translated into the coordinate system of the control and the area behind the control has already been painted. The background is painted by the top-level window control.
Overrides:
onPaint in class Control
Tags copied from class: Control
Parameters:
g - the graphics object for drawing
See Also:
Graphics

onEvent

public void onEvent(Event e)
handle scroll buttons and normal buttons
Overrides:
onEvent in class Control
Tags copied from class: Control
Parameters:
event - the event to process
See Also:
Event, KeyEvent, PenEvent

getPressedButtonIndex

public int getPressedButtonIndex()
returns the pressed button index