public class Dialog extends Form
Modality indicates that a dialog will block the calling thread even if the calling thread is the EDT. Notice that a dialog will not release the block until dispose is called even if show() from another form is called!
To determine the size of the dialog use the show method that accepts 4 integer values, notice that these values accept margin from the four sides rather than x, y, width and height values!
To style the dialog you would usually want to style the content pane rather than the dialog itself.
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_ALARM
Constant indicating the type of alert to indicate the sound to play or
icon if none are explicitly set
|
static int |
TYPE_CONFIRMATION
Constant indicating the type of alert to indicate the sound to play or
icon if none are explicitly set
|
static int |
TYPE_ERROR
Constant indicating the type of alert to indicate the sound to play or
icon if none are explicitly set
|
static int |
TYPE_INFO
Constant indicating the type of alert to indicate the sound to play or
icon if none are explicitly set
|
static int |
TYPE_NONE
Constant indicating the type of alert to indicate the sound to play or
icon if none are explicitly set
|
static int |
TYPE_WARNING
Constant indicating the type of alert to indicate the sound to play or
icon if none are explicitly set
|
focusScrolling
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
Constructor and Description |
---|
Dialog()
Constructs a Dialog with a title
|
Dialog(String title)
Constructs a Dialog with a title
|
Modifier and Type | Method and Description |
---|---|
protected void |
actionCommand(Command cmd)
Invoked to allow subclasses of form to handle a command from one point
rather than implementing many command instances
|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false.
|
protected void |
autoAdjust(int w,
int h)
Auto adjust size of the dialog.
|
void |
dispose()
Closes the current form and returns to the previous form, releasing the
EDT in the process
|
static String |
getDefaultDialogPosition()
Default screen orientation position for the upcoming dialog.
|
static int |
getDefaultDialogType()
The default type for dialogs
|
Style |
getDialogStyle()
Simple getter to get the Dialog Style
|
int |
getDialogType()
The type of the dialog can be one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
|
boolean |
isAutoDispose()
Determines whether the execution of a command on this dialog implicitly
disposes the dialog.
|
static boolean |
isCommandsAsButtons()
Places commands as buttons at the bottom of the standard static dialogs rather than
as softbuttons.
|
static boolean |
isDisableStaticDialogScrolling()
Allows a developer to indicate his interest that the dialog should no longer
scroll on its own but rather rely on the scrolling properties of internal
scrollable containers.
|
protected void |
onShow()
Allows subclasses to bind functionality that occurs when
a specific form or dialog appears on the screen
|
void |
pointerReleased(int x,
int y)
If this Component is focused, the pointer released event
will call this method
|
static void |
setAutoAdjustDialogSize(boolean a)
Indicates whether LWUIT should try to automatically adjust a showing dialog size
when a screen size change event occurs
|
void |
setAutoDispose(boolean autoDispose)
Determines whether the execution of a command on this dialog implicitly
disposes the dialog.
|
static void |
setCommandsAsButtons(boolean c)
Places commands as buttons at the bottom of the standard static dialogs rather than
as softbuttons.
|
static void |
setDefaultDialogPosition(String p)
Default screen orientation position for the upcoming dialog.
|
static void |
setDefaultDialogType(int d)
The default type for dialogs
|
void |
setDialogStyle(Style style)
Simple setter to set the Dialog Style
|
void |
setDialogType(int dialogType)
The type of the dialog can be one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
|
static void |
setDisableStaticDialogScrolling(boolean d)
Allows a developer to indicate his interest that the dialog should no longer
scroll on its own but rather rely on the scrolling properties of internal
scrollable containers.
|
protected void |
setDisposeWhenPointerOutOfBounds(boolean disposeWhenPointerOutOfBounds)
This flag indicates if the dialog should be disposed if a pointer
released event occurred out of the dialog content.
|
void |
setTimeout(long time)
Indicates the time (in milliseconds) afterwhich the dialog will be disposed
implicitly
|
void |
show()
The default version of show modal shows the dialog occupying the center portion
of the screen.
|
Command |
show(int top,
int bottom,
int left,
int right,
boolean includeTitle)
This method shows the form as a modal alert allowing us to produce a behavior
of an alert/dialog box.
|
Command |
show(int top,
int bottom,
int left,
int right,
boolean includeTitle,
boolean modal)
This method shows the form as a modal alert allowing us to produce a behavior
of an alert/dialog box.
|
static Command |
show(String title,
Component body,
Command[] cmds)
Shows a modal dialog with the given component as its "body" placed in the
center.
|
static Command |
show(String title,
Component body,
Command[] cmds,
int type,
Image icon)
Shows a modal dialog with the given component as its "body" placed in the
center.
|
static Command |
show(String title,
Component body,
Command[] cmds,
int type,
Image icon,
long timeout)
Shows a modal dialog with the given component as its "body" placed in the
center.
|
static Command |
show(String title,
Component body,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal dialog with the given component as its "body" placed in the
center.
|
static Command |
show(String title,
Component body,
Command defaultCommand,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal dialog with the given component as its "body" placed in the
center.
|
static Command |
show(String title,
String text,
Command[] cmds,
int type,
Image icon,
long timeout)
Shows a modal prompt dialog with the given title and text.
|
static Command |
show(String title,
String text,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal prompt dialog with the given title and text.
|
static Command |
show(String title,
String text,
Command defaultCommand,
Command[] cmds,
int type,
Image icon,
long timeout)
Shows a modal prompt dialog with the given title and text.
|
static Command |
show(String title,
String text,
Command defaultCommand,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal prompt dialog with the given title and text.
|
static boolean |
show(String title,
String text,
int type,
Image icon,
String okText,
String cancelText)
Shows a modal prompt dialog with the given title and text.
|
static boolean |
show(String title,
String text,
int type,
Image icon,
String okText,
String cancelText,
long timeout)
Shows a modal prompt dialog with the given title and text.
|
static boolean |
show(String title,
String text,
String okText,
String cancelText)
Shows a modal prompt dialog with the given title and text.
|
void |
showBack()
Displays the current form on the screen, this version of the method is
useful for "back" navigation since it reverses the direction of the transition.
|
Command |
showDialog()
Shows a modal dialog and returns the command pressed within the modal dialog
|
void |
showModeless()
Shows a modeless dialog which is useful for some simpler use cases such as
progress indication etc...
|
Command |
showPacked(String position,
boolean modal)
Convenience method to show a dialog sized to match its content.
|
addCommand, addCommand, addCommandListener, addComponent, addComponent, addComponent, addComponent, addGameKeyListener, addKeyListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, calculateTouchCommandGridColumns, createCommandComponent, createCommandList, createMenuCancelCommand, createMenuSelectCommand, createSelectCommand, createTouchCommandButton, deregisterAnimated, dispatchCommand, getBackCommand, getClearCommand, getCommand, getCommandCount, getComponentForm, getComponentIndex, getContentPane, getDefaultCommand, getFocused, getGlassPane, getLayout, getMenuStyle, getScrollAnimationSpeed, getSoftButton, getSoftButtonCount, getSoftButtonStyle, getTintColor, getTitle, getTitleComponent, getTitleStyle, getTransitionInAnimator, getTransitionOutAnimator, hasMedia, hideNotify, isCyclicFocus, isFocusScrolling, isReverseSoftButtons, isSingleFocusMode, isSmoothScrolling, keyPressed, keyReleased, keyRepeated, longKeyPress, longPointerPress, onShowCompleted, paint, paintBackground, paramString, pointerDragged, pointerHover, pointerHoverReleased, pointerPressed, refreshTheme, registerAnimated, removeAll, removeAllCommands, removeCommand, removeCommandListener, removeComponent, removeGameKeyListener, removeKeyListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, replace, replaceAndWait, scrollComponentToVisible, setBackCommand, setBgImage, setClearCommand, setCommandListener, setCyclicFocus, setDefaultCommand, setFocused, setFocusScrolling, setGlassPane, setLayout, setMenuCellRenderer, setMenuStyle, setMenuTransitions, setRTL, setScrollable, setScrollableX, setScrollableY, setScrollAnimationSpeed, setSmoothScrolling, setSoftButtonStyle, setTintColor, setTitle, setTitleComponent, setTitleComponent, setTitleStyle, setTransitionInAnimator, setTransitionOutAnimator, setVisible, showMenuDialog, showNotify, sizeChanged
applyRTL, calcPreferredSize, contains, flushReplace, getComponentAt, getComponentAt, getComponentCount, getLayoutHeight, getLayoutWidth, getScrollIncrement, invalidate, isScrollableX, isScrollableY, layoutContainer, paintGlass, revalidate, setCellRenderer, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout
addFocusListener, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragInitiated, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getDirtyRegion, getHeight, getLabelForComponent, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getScrollDimension, getScrollX, getScrollY, getSelectCommandText, getSelectedStyle, getSideGap, getStyle, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, handlesInput, hasFocus, initComponent, initCustomStyle, isBorderPainted, isDragActivated, isEnabled, isFocusable, isFocusPainted, isInitialized, isRTL, isScrollable, isScrollVisible, isSelectableInteraction, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerPressed, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setBorderPainted, setDirtyRegion, setEnabled, setFocus, setFocusable, setFocusPainted, setHandlesInput, setHeight, setInitialized, setIsScrollVisible, setLabelForComponent, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setScrollSize, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setStyle, setTactileTouch, setTensileDragEnabled, setUIID, setUnselectedStyle, setUnSelectedStyle, setWidth, setX, setY, styleChanged, toString
public static final int TYPE_NONE
public static final int TYPE_ALARM
public static final int TYPE_CONFIRMATION
public static final int TYPE_ERROR
public static final int TYPE_INFO
public static final int TYPE_WARNING
public Dialog(String title)
title
- the title of the dialogpublic Dialog()
public void setDialogStyle(Style style)
style
- public Style getDialogStyle()
public Command show(int top, int bottom, int left, int right, boolean includeTitle)
Modal dialogs Allow the forms "content" to "hang in mid air" this is especially useful for dialogs where you would want the underlying form to "peek" from behind the form.
top
- space in pixels between the top of the screen and the formbottom
- space in pixels between the bottom of the screen and the formleft
- space in pixels between the left of the screen and the formright
- space in pixels between the right of the screen and the formincludeTitle
- whether the title should hang in the top of the screen or
be glued onto the content panepublic Command show(int top, int bottom, int left, int right, boolean includeTitle, boolean modal)
Modal dialogs Allow the forms "content" to "hang in mid air" this is especially useful for dialogs where you would want the underlying form to "peek" from behind the form.
top
- space in pixels between the top of the screen and the formbottom
- space in pixels between the bottom of the screen and the formleft
- space in pixels between the left of the screen and the formright
- space in pixels between the right of the screen and the formincludeTitle
- whether the title should hang in the top of the screen or
be glued onto the content panemodal
- indicates the dialog should be modal set to false for modeless dialog
which is useful for some use casespublic void setTimeout(long time)
time
- a milliseconds time used to dispose the dialogpublic static boolean show(String title, String text, int type, Image icon, String okText, String cancelText)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nullokText
- the text to appear in the command dismissing the dialogcancelText
- optionally null for a text to appear in the cancel command
for canceling the dialogprotected void autoAdjust(int w, int h)
w
- width of the screenh
- height of the screenpublic static boolean show(String title, String text, int type, Image icon, String okText, String cancelText, long timeout)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nullokText
- the text to appear in the command dismissing the dialogcancelText
- optionally null for a text to appear in the cancel command
for canceling the dialogtimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedpublic static Command show(String title, String text, Command[] cmds, int type, Image icon, long timeout)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedpublic static Command show(String title, String text, Command defaultCommand, Command[] cmds, int type, Image icon, long timeout)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogdefaultCommand
- command to be assigned as the default command or nullcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedpublic static Command show(String title, String text, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedtransition
- the transition installed when the dialog enters/leavespublic static Command show(String title, String text, Command defaultCommand, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogdefaultCommand
- command to be assigned as the default command or nullcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedtransition
- the transition installed when the dialog enters/leavespublic static boolean show(String title, String text, String okText, String cancelText)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogokText
- the text to appear in the command dismissing the dialogcancelText
- optionally null for a text to appear in the cancel command
for canceling the dialogpublic static Command show(String title, Component body, Command[] cmds)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formpublic static Command show(String title, Component body, Command[] cmds, int type, Image icon)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nullpublic static Command show(String title, Component body, Command[] cmds, int type, Image icon, long timeout)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedpublic static Command show(String title, Component body, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedtransition
- the transition installed when the dialog enters/leavespublic static Command show(String title, Component body, Command defaultCommand, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- title for the dialogbody
- component placed in the center of the dialogdefaultCommand
- command to be assigned as the default command or nullcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 inifinite time is usedtransition
- the transition installed when the dialog enters/leavesprotected void onShow()
Form
public void showBack()
Form
public void show()
public void showModeless()
public Command showPacked(String position, boolean modal)
position
- one of the values from the BorderLayout class e.g. BorderLayout.CENTER, BorderLayout.NORTH etc.modal
- whether the dialog should be modal or modalesspublic void dispose()
public Command showDialog()
protected void actionCommand(Command cmd)
actionCommand
in class Form
cmd
- the action commandpublic boolean animate()
Animation
Display
class.public boolean isAutoDispose()
public void setAutoDispose(boolean autoDispose)
autoDispose
- true if this dialog disposes on any commandpublic static void setDefaultDialogPosition(String p)
p
- for dialogs on the sceen using BorderLayout orientation tagspublic static String getDefaultDialogPosition()
public int getDialogType()
public void setDialogType(int dialogType)
dialogType
- can be one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMpublic static void setDefaultDialogType(int d)
d
- the default type for the dialogpublic static int getDefaultDialogType()
public static void setAutoAdjustDialogSize(boolean a)
a
- true to indicate that LWUIT should make a "best effort" to resize the dialogpublic static void setDisableStaticDialogScrolling(boolean d)
d
- indicates whether scrolling should be active or notpublic static boolean isDisableStaticDialogScrolling()
public static void setCommandsAsButtons(boolean c)
commandsAsButtons
- true to place commands as buttons and not as softbutton keyspublic static boolean isCommandsAsButtons()
protected void setDisposeWhenPointerOutOfBounds(boolean disposeWhenPointerOutOfBounds)
disposeWhenPointerOutOfBounds
- public void pointerReleased(int x, int y)
Component
pointerReleased
in class Form
x
- the pointer x coordinatey
- the pointer y coordinate