|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.nitus.missatges.MsgUtils
public class 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 |
noFet()
Pita i mostra un missatge amb el t�tol "No implementat:" i el missatge "Funci� no implementada. |
static void |
noFet(java.lang.String missatge)
Pita i mostra un missatge amb el t�tol "No implementat:" i el missatge que ens passen com a par�metre. |
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 int |
showQuestion(java.awt.Component comp,
java.lang.Object msg)
Shows a confirm dialog using JOptionPane.showConfirmDialog()
method and the default question title. |
static int |
showQuestion(java.awt.Component comp,
java.lang.Object msg,
boolean formatted)
Shows a confirm dialog using JOptionPane.showConfirmDialog()
method and the default question title. |
static int |
showQuestion(java.awt.Component comp,
java.lang.String title,
java.lang.Object msg)
Shows a confirm dialog using JOptionPane.showConfirmDialog()
method. |
static int |
showQuestion(java.awt.Component comp,
java.lang.String title,
java.lang.Object msg,
boolean formatted)
Shows a confirm dialog using JOptionPane.showConfirmDialog()
method and the default question title. |
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 ). |
static void |
showWarning(java.awt.Component comp,
java.lang.String title,
java.lang.Object msg,
boolean formatted)
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
.
s
- String to be formatted
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
.
s
- String to be formattedlen
- 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
- booleanpublic static void showWarning(java.awt.Component comp, java.lang.String title, 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
- booleanpublic static int showQuestion(java.awt.Component comp, java.lang.String title, java.lang.Object msg)
JOptionPane.showConfirmDialog()
method.
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 displaytitle
- The dialog title
int
indicating the option selected by the userpublic static int showQuestion(java.awt.Component comp, java.lang.Object msg)
JOptionPane.showConfirmDialog()
method and the default question title.
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 display
int
indicating the option selected by the userpublic static int showQuestion(java.awt.Component comp, java.lang.Object msg, boolean formatted)
JOptionPane.showConfirmDialog()
method and the default question title.
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
- Indicates if the msg will be formatted with
DEFAULT_LINE_LENGTH
(true) or not (false)
int
indicating the option selected by the userpublic static int showQuestion(java.awt.Component comp, java.lang.String title, java.lang.Object msg, boolean formatted)
JOptionPane.showConfirmDialog()
method and the default question title.
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 displaytitle
- The dialog titleformatted
- Indicates if the msg will be formatted with
DEFAULT_LINE_LENGTH
(true) or not (false)
int
indicating the option selected by the userpublic static void noFet(java.lang.String missatge)
missatge
- public static void noFet()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |