waba.ui
Class InputDialog

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

public class InputDialog
extends Window

This class pops up a Window with a Label, an Edit and some buttons. Good to input some text from the user. Here is an example (taken from examples/apps/GuiBuilder):

// on some event...
if (renameDialog == null)
renameDialog = new InputDialog("Project Rename","Enter the new name:","");
renameDialog.setValue(projectName);
popupBlockingModal(renameDialog);
// when window closes...
if (renameDialog.getPressedButtonIndex() == 0) // ok?
{
projectName = renameDialog.getValue();
}


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
InputDialog(String title, String text, String defaultValue)
          Creates a new InputDialog with the given window Title, the given label Text, the given Default value for the Edit, and two buttons "Ok" and "Cancel".
InputDialog(String title, String text, String defaultValue, String[] buttonCaptions)
          Creates a new InputDialog with the given window Title, the given label Text, the given Default value for the Edit and with the given buttons.
 
Method Summary
 Edit getEdit()
          Returns the Edit so you can set its properties.
 int getPressedButtonIndex()
          Returns the pressed button index, starting from 0
 String getValue()
          Returns the value entered
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
protected  void postPopup()
          Placeholder called after the popup is done and after the repaint of this window. the default implementation does nothing.
 void setValue(String value)
          Sets the default value on the Edit field
 
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, postUnpop, pumpEvents, saveBehind, setBorderStyle, setDoubleBuffer, setFocus, setMenuBar, setStatePosition, setTitle, setTitleFont, swap, unpop, validate
 
Methods inherited from class waba.ui.Container
add, add, add, broadcastEvent, findChild, getChildren, onPaint, onStart, paintChildren, remove, setEnabled
 
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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Constructor Detail

InputDialog

public InputDialog(String title,
                   String text,
                   String defaultValue)
Creates a new InputDialog with the given window Title, the given label Text, the given Default value for the Edit, and two buttons "Ok" and "Cancel". The text used in a Label must be one line only!

InputDialog

public InputDialog(String title,
                   String text,
                   String defaultValue,
                   String[] buttonCaptions)
Creates a new InputDialog with the given window Title, the given label Text, the given Default value for the Edit and with the given buttons. The text used in a Label must be one line only!
Method Detail

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

postPopup

protected void postPopup()
Description copied from class: Window
Placeholder called after the popup is done and after the repaint of this window. the default implementation does nothing.
Overrides:
postPopup in class Window

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

getValue

public String getValue()
Returns the value entered

setValue

public void setValue(String value)
Sets the default value on the Edit field

getEdit

public Edit getEdit()
Returns the Edit so you can set its properties.