|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.qfs.lib.gui.Message
A collection of convenience methods to bring up localized versions of standard dialogs.
Before any dialogs can be shown, the resources to use must be set with
the setResources
method. The resource bundle must
contain at least the following values:
dialog.cancel.name | Default label for the Cancel button |
dialog.no.name | Default label for the No button |
dialog.ok.name | Default label for the OK button |
dialog.yes.name | Default label for the Yes button |
/de/qfs/lib/resources/properties/qflib
in
qflib.jar
and added automatically during initialization of
the Message
class.Additionally for each message to display the following resources are used:
<messageName>.title | The title for <messageName> |
<messageName>.message | The message for <messageName> | <messageName>.custom | Number of custom objects to display. If this is set,
<messageName>.message may be omitted. The custom objects to display
are taken from the param array in the call to showMessage . See JOptionPane . |
<messageName>.type | The message type for <messageName>. Possible values are plain, info, question, warning and error, which is the default. |
<messageName>.buttons | The buttons to use for <messageName>. Possible values are custom, okcancel, yesno, yesnocancel and ok, which is the default. |
<messageName>.button<num> | If button type custom was chosen, use one button<num> resource for each button with num starting at 0 in the order in which they are to appear. |
<messageName>.icon | The icon resource name for <messageName> (optional) |
The Dialogs shown will have their name set depending on the type of the message as follows:
JOptionPane.PLAIN_MESSAGE | "Message.message" |
JOptionPane.INFORMATION_MESSAGE | "Message.info" |
JOptionPane.QUESTION_MESSAGE | "Message.question" |
JOptionPane.WARNING_MESSAGE | "Message.warning" |
JOptionPane.ERROR_MESSAGE | "Message.error" |
JOptionPane
Method Summary | |
static void |
addResources(java.util.ResourceBundle resources)
Add some resources of the Message class. |
static java.lang.String |
format(java.lang.String resource,
java.lang.Object[] param)
Convenience method that creates a message from a resource string and its parameters. |
static java.util.ResourceBundle |
getResources()
Get the resources of the Message class. |
static void |
setResources(java.util.ResourceBundle resources)
Set the resources of the Message class. |
static int |
showMessage(java.awt.Component parent,
java.lang.String resource)
Bring up a localized message dialog. |
static int |
showMessage(java.awt.Component parent,
java.lang.String resource,
java.lang.Object[] param)
Bring up a parameterized, localized message dialog. |
static int |
showOK(java.awt.Component parent,
java.lang.Object message,
java.lang.String title,
int messageType,
javax.swing.Icon icon)
Bring up a localized confirm dialog with OK as the single option. |
static int |
showOKCancel(java.awt.Component parent,
java.lang.Object message,
java.lang.String title,
int messageType,
javax.swing.Icon icon)
Bring up a localized OK/Cancel dialog. |
static int |
showYesNo(java.awt.Component parent,
java.lang.Object message,
java.lang.String title,
int messageType,
javax.swing.Icon icon)
Bring up a localized Yes/No dialog. |
static int |
showYesNoCancel(java.awt.Component parent,
java.lang.Object message,
java.lang.String title,
int messageType,
javax.swing.Icon icon)
Bring up a localized Yes/No/Cancel dialog. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static final java.util.ResourceBundle getResources()
public static final void setResources(java.util.ResourceBundle resources)
resources
- The resources to set.public static final void addResources(java.util.ResourceBundle resources)
resources
- The resources to add.public static int showYesNo(java.awt.Component parent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon)
parent
- A Component belonging to the parent frame for the
dialog.message
- The message to display.title
- The title of the dialog.messageType
- The type of the message, see
JOptionPane
.icon
- An icon for the message.JOptionPane
).public static int showYesNoCancel(java.awt.Component parent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon)
parent
- A Component belonging to the parent frame for the
dialog.message
- The message to display.title
- The title of the dialog.messageType
- The type of the message, see
JOptionPane
.icon
- An icon for the message.JOptionPane
).public static int showOKCancel(java.awt.Component parent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon)
parent
- A Component belonging to the parent frame for the
dialog.message
- The message to display.title
- The title of the dialog.messageType
- The type of the message, see
JOptionPane
.icon
- An icon for the message.JOptionPane
).public static int showOK(java.awt.Component parent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon)
parent
- A Component belonging to the parent frame for the
dialog.message
- The message to display.title
- The title of the dialog.messageType
- The type of the message, see
JOptionPane
.icon
- An icon for the message.JOptionPane
).public static int showMessage(java.awt.Component parent, java.lang.String resource)
setResources
.parent
- A Component belonging to the parent frame for the
dialog.resource
- The basename of the resources to use.JOptionPane
).public static int showMessage(java.awt.Component parent, java.lang.String resource, java.lang.Object[] param)
setResources
.parent
- A Component belonging to the parent frame for the
dialog.resource
- The basename of the resources to use.param
- Array of parameters for the message. If the resource
for custom is set, the first n objects are used as
custom objects. The rest is used to format the
message.JOptionPane
).public static java.lang.String format(java.lang.String resource, java.lang.Object[] param)
resource
- The name of the resource.param
- The parameter values.
|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |