public class WarningMessageDialog extends MessageDialog
Be careful not to overdo it - a Dialog popping up to confirm every last action is a) really annoying and worse b) will desensitize the user to the message - they will just start ignoring the Dialog and thus probably miss the chance to avoid something really important.
This is a modal MessageDialog of type WARNING
with an "Ok" Button for the user to confirm they want to proceed, and a
"Cancel" Button for them to abort the operation.
final Window w; final Dialog d; final ResponseType result; d = new WarningMessageDialog(w, "You are about set off the fire alarm", "Is that what you really want to do?"); result = d.run(); d.hide(); if (result == ResponseType.OK) { // do dangerous action }
Dialog.Response
Window.ConfigureEvent, Window.DeleteEvent
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
Constructor and Description |
---|
WarningMessageDialog(Window parent,
String primary,
String secondary) |
getSecondaryUseMarkup, getUseMarkup, setImage, setSecondaryText, setSecondaryText, setSecondaryUseMarkup, setUseMarkup
add, addButton, addButton, addButton, connect, emitResponse, run, setDefaultResponse
addAcceleratorGroup, connect, connect, getHeight, getMaximized, getPositionX, getPositionY, getScreen, getWidth, move, present, resize, setDecorated, setDefaultSize, setFullscreen, setGravity, setHasResizeGrip, setIcon, setIcon, setKeepAbove, setKeepBelow, setMaximize, setModal, setPosition, setResizable, setSkipPagerHint, setSkipTaskbarHint, setStick, setTitle, setTransientFor, setTypeHint
getChildren, remove, setBorderWidth
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public WarningMessageDialog(Window parent, String primary, String secondary)