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);
popupBlockingModal(mb);
Note: this class does not do automatic parse of the text, because this is a slow operation.
But you can use the method waba.sys.Convert.insertLineBreak to do that.
Fields inherited from class waba.ui.Window |
beepIfOut,
borderStyle,
canDrag,
eraseBackgroundNow,
flicker,
HIDE_STATE,
highResPrepared,
imgCovered,
lastSwappedContainer,
mainSwapContainer,
menubar,
needsPaint,
NO_BORDER,
RECT_BORDER,
ROUND_BORDER,
TAB_BORDER,
TAB_ONLY_BORDER,
title,
titleFont,
topMost,
VK_BOTTOM,
VK_HIDE,
VK_TOP,
zStack |
Fields inherited from class waba.ui.Container |
BORDER_LOWERED,
BORDER_NONE,
BORDER_RAISED,
BORDER_SIMPLE,
children,
lastH,
lastW,
lastX,
lastY,
parentWindow,
tail |
Fields inherited from class waba.ui.Control |
AFTER,
appId,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
font,
foreColor,
foreDis,
height,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
visible,
width,
x,
x2,
y,
y2 |
Constructor Summary |
MessageBox(String title,
String msg)
constructs a message box with the text and one "Ok" button |
MessageBox(String title,
String text,
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, starting from 0 |
protected void |
onColorsChanged(boolean colorsChanged)
Called after a setEnabled, setForeColor and setBackColor and when a control has
been added to a Container. |
void |
onEvent(Event e)
handle scroll buttons and normal buttons |
void |
onPaint(Graphics g)
Draws the border (if any). |
void |
setTextAlignment(int align)
Sets the alignment for the text. |
void |
setUnpopDelay(int unpopDelay)
sets a delay for the unpop of this dialog |
Methods inherited from class waba.ui.Window |
_doPaint,
_doPaint,
_postEvent,
damageRect,
destroyZStack,
dontSaveBehind,
getClientRect,
getFocus,
getOffScreen,
getPreferredHeight,
getPreferredWidth,
getTopMost,
isTopMost,
isVisible,
loadBehind,
makeUnmovable,
onClickedOutside,
onPopup,
onUnpop,
paintTitle,
popupBlockingModal,
popupMenuBar,
popupModal,
postPopup,
postUnpop,
pumpEvents,
saveBehind,
setBorderStyle,
setDoubleBuffer,
setFocus,
setMenuBar,
setStatePosition,
setTitle,
setTitleFont,
swap,
unpop,
validate |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getBackColor,
getFont,
getFontMetrics,
getForeColor,
getNext,
getParent,
getParentWindow,
getPos,
getRect,
getSize,
isDisplayed,
isEnabled,
onBoundsChanged,
onFontChanged,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
requestFocus,
setBackColor,
setBackForeColors,
setFocusLess,
setFont,
setForeColor,
setRect,
setRect,
setRect,
setVisible |
MessageBox
public MessageBox(String title,
String msg)
- constructs a message box with the text and one "Ok" button
MessageBox
public MessageBox(String title,
String text,
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
setTextAlignment
public void setTextAlignment(int align)
- Sets the alignment for the text. Must be CENTER (default), LEFT or RIGHT
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: Container
- Draws the border (if any). If you override this method, be sure to call
super.onPaint(g);
, or the border will not be drawn.
- Overrides:
- onPaint in class Container
- Tags copied from class: Control
- Parameters:
g
- the graphics object for drawing- See Also:
Graphics
onColorsChanged
protected void onColorsChanged(boolean colorsChanged)
- Description copied from class: Control
- Called after a setEnabled, setForeColor and setBackColor and when a control has
been added to a Container. If colorsChanged
is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was
called from setEnabled
- Overrides:
- onColorsChanged in class Container
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, starting from 0