java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
|
+--java.awt.Dialog
|
+--de.cgarbs.awt.MessageBox
Displays a simple modal message box on the screen waiting for the user to click a button. Compatible with JAVA[tm] 1.0 The button's IDs can either be used directly (OKHELP or YESNOHELP) or you can create your own combinations by ORing IDs (OK | NO | HELP). This class is licensed under the GNU LESSER GENERAL PUBLIC LICENSE.
| Field Summary | |
protected java.awt.Panel |
buttonPanel
This panel contains the buttons. |
protected java.awt.Button |
cancel
This is the button labeled "cancel". |
static int |
CANCEL
The ID of just a cancel button. |
protected java.awt.Button |
help
This is the button labeled "help". |
static int |
HELP
The ID of just a help button. |
protected java.awt.Button |
no
This is the button labeled "no". |
static int |
NO
The ID of just a no button. |
protected java.awt.Button |
ok
This is the button labeled "ok". |
static int |
OK
The ID of just an ok button. |
static int |
OKCANCEL
The ID of an ok and a cancel button. |
static int |
OKCANCELHELP
The ID of an ok, a cancel and a help button. |
static int |
OKHELP
The ID of an ok and a help button. |
protected int |
pressed
Sums up the IDs of all pressed buttons. |
static int |
SPLASH
The ID of a splash screen (a window with no buttons, the MessageBox should remove the MessageBox by itself). |
protected java.awt.TextArea |
text
This TextArea contains the message to be displayed. |
protected java.awt.Button |
yes
This is the button labeled "yes". |
static int |
YES
The ID of just a yes button. |
static int |
YESNO
The ID of a yes and a no button. |
static int |
YESNOHELP
The ID of a yes, a no and a help button. |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
MessageBox(java.awt.Frame parent,
java.lang.String message)
Displays a new MessageBox with only an ok button and an empty title. |
|
MessageBox(java.awt.Frame parent,
java.lang.String message,
java.lang.String title)
Displays a new MessageBox with only an ok button. |
|
MessageBox(java.awt.Frame parent,
java.lang.String message,
java.lang.String title,
int buttons)
Displays a new MessageBox. |
|
MessageBox(java.lang.String message)
Displays a new MessageBox with only an ok button and an empty title without parent Frame. |
|
MessageBox(java.lang.String message,
java.lang.String title)
Displays a new MessageBox with only an ok button without parent Frame. |
|
MessageBox(java.lang.String message,
java.lang.String title,
int buttons)
Displays a new MessageBox with no parent Frame. |
|
| Method Summary | |
boolean |
action(java.awt.Event e,
java.lang.Object o)
Deprecated. As of JDK 1.1 ActionListeners should be used (but aren't in this class). |
boolean |
handleEvent(java.awt.Event e)
Deprecated. As of JDK 1.1 processEvent() should be used (but isn't in this class). |
boolean |
isCancel()
Checks if the button cancel has been pressed. |
boolean |
isHelp()
Checks if the button help has been pressed. |
boolean |
isNo()
Checks if the button no has been pressed. |
boolean |
isNothing()
Checks if no button was pressed (eg. the window was closed using window controls). |
boolean |
isOk()
Checks if the button ok has been pressed. |
boolean |
isYes()
Checks if the button yes has been pressed. |
static void |
main(java.lang.String[] args)
A demonstration of this class. |
| Methods inherited from class java.awt.Dialog |
addNotify,
dispose,
getTitle,
hide,
isModal,
isResizable,
paramString,
setModal,
setResizable,
setTitle,
show |
| Methods inherited from class java.awt.Window |
addWindowListener,
applyResourceBundle,
applyResourceBundle,
finalize,
getFocusOwner,
getInputContext,
getLocale,
getOwnedWindows,
getOwner,
getToolkit,
getWarningString,
isShowing,
pack,
postEvent,
processEvent,
processWindowEvent,
removeWindowListener,
setCursor,
toBack,
toFront |
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paint,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setFont,
setLayout,
update,
validate,
validateTree |
| Methods inherited from class java.awt.Component |
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputMethodRequests,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getSize,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
hasFocus,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
size,
toString,
transferFocus |
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int SPLASH
public static final int OK
public static final int CANCEL
public static final int HELP
public static final int YES
public static final int NO
public static final int OKCANCEL
public static final int OKHELP
public static final int OKCANCELHELP
public static final int YESNO
public static final int YESNOHELP
protected int pressed
protected java.awt.Button ok
protected java.awt.Button cancel
protected java.awt.Button help
protected java.awt.Button yes
protected java.awt.Button no
protected java.awt.TextArea text
protected java.awt.Panel buttonPanel
| Constructor Detail |
public MessageBox(java.lang.String message)
message - The message to be displayed.
public MessageBox(java.lang.String message,
java.lang.String title)
message - The message to be displayed.title - The title of this MessageBox.
public MessageBox(java.lang.String message,
java.lang.String title,
int buttons)
message - The message to be displayed.title - The title of this MessageBox.buttons - The ID of the buttons to show.
public MessageBox(java.awt.Frame parent,
java.lang.String message)
parent - The parent Frame of this MessageBox.message - The message to be displayed.
public MessageBox(java.awt.Frame parent,
java.lang.String message,
java.lang.String title)
parent - The parent Frame of this MessageBox.message - The message to be displayed.title - The title of this MessageBox.
public MessageBox(java.awt.Frame parent,
java.lang.String message,
java.lang.String title,
int buttons)
parent - The parent Frame of this MessageBox.message - The message to be displayed.title - The title of this MessageBox.buttons - The ID of the buttons to show.| Method Detail |
public boolean action(java.awt.Event e,
java.lang.Object o)
e - o - public boolean handleEvent(java.awt.Event e)
e - public boolean isOk()
public boolean isCancel()
public boolean isYes()
public boolean isNo()
public boolean isHelp()
public boolean isNothing()
public static void main(java.lang.String[] args)
args - command line arguments (unused)