|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.froses.msgtools.MsgUtils
Static methods to generate and show messages using JOptionPane
.
There are methods to generate dialogs for error, warning, and question messages.
Features:
String
or a JLabel
.
DEFAULT_LINE_LENGTH
value. The message is splitted using word
boundaries.
Field Summary | |
static int |
DEFAULT_LINE_LENGTH
|
static java.lang.String |
errorDefaultTitle
|
static java.lang.String |
questionDefaultTitle
|
static java.lang.String |
warningDefaultTitle
|
Constructor Summary | |
MsgUtils()
|
Method Summary | |
static java.lang.Object |
formatMsg(java.lang.Object o)
Splits a string into lines of DEFAULT_LINE_LENGTH length.
|
static java.lang.Object |
formatMsg(java.lang.Object o,
int len)
Splits a string into substring adjusting the substring length to a maximum of len characters. |
static java.lang.String |
getErrorDefaultTitle()
|
static java.lang.String |
getQuestionDefaultTitle()
|
static java.lang.String |
getWarningDefaultTitle()
|
static void |
setErrorDefaultTitle(java.lang.String errorDefaultTitle)
Sets the error messages dialogs title. |
static void |
setQuestionDefaultTitle(java.lang.String questionDefaultTitle)
Sets the question messages dialogs title. |
static void |
setWarningDefaultTitle(java.lang.String newValue)
Sets the warning messages dialogs title. |
static void |
showError(java.awt.Component comp,
java.lang.Object msg)
Displays an error dialog using the JOptionPane.showMessageDialog() method.
|
static void |
showError(java.awt.Component comp,
java.lang.Object msg,
boolean formated)
Displays an error dialog using the JOptionPane.showMessageDialog() method.
|
static void |
showError(java.awt.Component comp,
java.lang.String title,
java.lang.Object msg)
Displays an error dialog using the JOptionPane.showMessageDialog() method. |
static void |
showError(java.awt.Component comp,
java.lang.String title,
java.lang.Object msg,
boolean formated)
Displays an error dialog using the JOptionPane.showMessageDialog() method.
|
static void |
showWarning(java.awt.Component comp,
java.lang.Object msg)
Mostra una caixa de diàleg d'avís (Usa una JOptionPane ).
|
static void |
showWarning(java.awt.Component comp,
java.lang.Object msg,
boolean formatted)
Mostra una caixa de diàleg d'avís (Usa una JOptionPane ).
|
static void |
showWarning(java.awt.Component comp,
java.lang.String title,
java.lang.Object msg)
Mostra una caixa de diàleg d'avís (Usa una JOptionPane ). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String warningDefaultTitle
public static java.lang.String errorDefaultTitle
public static java.lang.String questionDefaultTitle
public static int DEFAULT_LINE_LENGTH
Constructor Detail |
public MsgUtils()
Method Detail |
public static java.lang.Object formatMsg(java.lang.Object o)
DEFAULT_LINE_LENGTH
length.
DEFAULT_LINE_LENGTH
.
formatMsg(Object, int)
public static java.lang.Object formatMsg(java.lang.Object o, int len)
len
characters. The split point is ever between two
words. The parameter len
must be a positive whole number.
Ignores the existing line feeds into s
.
len
- Splitted line maximum length
java.lang.IllegalArgumentException
- If len
is'nt a positive whole number.public static java.lang.String getWarningDefaultTitle()
public static java.lang.String getErrorDefaultTitle()
public static void setErrorDefaultTitle(java.lang.String errorDefaultTitle)
errorDefaultTitle
- The errorDefaultTitle to set.public static void setWarningDefaultTitle(java.lang.String newValue)
newValue
- The questionDefaultTitle to set.public static java.lang.String getQuestionDefaultTitle()
public static void setQuestionDefaultTitle(java.lang.String questionDefaultTitle)
questionDefaultTitle
- The questionDefaultTitle to set.public static void showError(java.awt.Component comp, java.lang.Object msg)
JOptionPane.showMessageDialog()
method.
The dialog title is the errorDefaultTitle
.
comp
- java.awt.Componentmsg
- java.lang.Objectpublic static void showError(java.awt.Component comp, java.lang.String title, java.lang.Object msg)
JOptionPane.showMessageDialog()
method.
comp
- java.awt.Componenttitle
- java.lang.Stringmsg
- java.lang.Objectpublic static void showError(java.awt.Component comp, java.lang.String title, java.lang.Object msg, boolean formated)
JOptionPane.showMessageDialog()
method.
You can specify if the msg
must be formatted or not.
comp
- java.awt.Componenttitle
- java.lang.Stringmsg
- java.lang.Objectformated
- booleanpublic static void showError(java.awt.Component comp, java.lang.Object msg, boolean formated)
JOptionPane.showMessageDialog()
method.
The dialog title is the errorDefaultTitle
.
You can specify if the msg
must be formatted or not.
comp
- java.awt.Componentmsg
- java.lang.Objectformated
- booleanpublic static void showWarning(java.awt.Component comp, java.lang.Object msg)
JOptionPane
).
El títol de la caixa de diàleg per defecte és Aviso:
.
comp
- java.awt.Componentmsg
- java.lang.Objectpublic static void showWarning(java.awt.Component comp, java.lang.String title, java.lang.Object msg)
JOptionPane
).
comp
- java.awt.Componenttitle
- java.lang.Stringmsg
- java.lang.Objectpublic static void showWarning(java.awt.Component comp, java.lang.Object msg, boolean formatted)
JOptionPane
).
El títol de la caixa de diàleg per defecte és Aviso:
.
Permet especificar si cal formatar el missatge o no. Creation date: (28/7/01 18:30:40)
comp
- Determines the Frame in which the dialog is displayed; if null, or
if the parentComponent has no Frame, a default Frame is usedmsg
- Object containing the message to displayformatted
- boolean
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |