Klasse SwingMessageOutput
java.lang.Object
net.sf.jguiraffe.gui.platform.swing.builder.utils.SwingMessageOutput
- Alle implementierten Schnittstellen:
MessageOutput
A Swing specific implementation of the MessageOutput
interface.
This implementation makes use of JOptionPane
for displaying
message boxes.
- Version:
- $Id: SwingMessageOutput.java 205 2012-01-29 18:29:57Z oheger $
- Autor:
- Oliver Heger
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final int
Constant for a line length which disables line wrapping.Von Schnittstelle geerbte Felder net.sf.jguiraffe.gui.builder.utils.MessageOutput
BTN_OK, BTN_OK_CANCEL, BTN_YES_NO, BTN_YES_NO_CANCEL, MESSAGE_ERROR, MESSAGE_INFO, MESSAGE_PLAIN, MESSAGE_QUESTION, MESSAGE_WARNING, RET_CANCEL, RET_NO, RET_OK, RET_YES
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCreates a new instance ofSwingMessageOutput
and sets a default maximum line length.SwingMessageOutput
(int maxLineLength) Creates a new instance ofSwingMessageOutput
with the specified maximum message line length. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected int
convertButtonType
(int type) Converts the passed in button type into the corresponding option type used byJOptionPane
.protected int
convertMessageType
(int type) Converts the passed in message type into the corresponding type used byJOptionPane
.protected int
convertReturnValue
(int value) Converts the passed in return value from theJOptionPane
to the correspondingRET_XXXX
constant.protected JDialog
createDialog
(JOptionPane pane, Window parent, String title) Creates the dialog from the option pane.protected JOptionPane
createOptionPane
(Window parent, Object message, String title, int messageType, int optionType) Creates the option pane dialog for displaying the message box.int
Returns the maximum line length for the messages to be displayed.int
Displays a message box.protected Object
showPane
(JOptionPane pane, JDialog dialog) Displays the given option pane.
-
Felddetails
-
NO_LINE_WRAP
public static final int NO_LINE_WRAPConstant for a line length which disables line wrapping. If this value is passed to the constructor, the message text is not wrapped into multiple lines.- Seit:
- 1.3
- Siehe auch:
-
-
Konstruktordetails
-
SwingMessageOutput
public SwingMessageOutput()Creates a new instance ofSwingMessageOutput
and sets a default maximum line length. -
SwingMessageOutput
public SwingMessageOutput(int maxLineLength) Creates a new instance ofSwingMessageOutput
with the specified maximum message line length. Before the message is displayed, it is ensured that single lines do not exceed this maximum length; if necessary, the text is split into multiple lines. To disable line wrapping, the valueNO_LINE_WRAP
can be passed.- Parameter:
maxLineLength
- the maximum length of a line for the message text (in characters); must be > 0- Löst aus:
IllegalArgumentException
- if an invalid line length is passed in- Seit:
- 1.3
-
-
Methodendetails
-
getMaximumLineLength
public int getMaximumLineLength()Returns the maximum line length for the messages to be displayed.- Gibt zurück:
- the maximum line length
- Seit:
- 1.3
-
show
Displays a message box.- Angegeben von:
show
in SchnittstelleMessageOutput
- Parameter:
parent
- the parent window; this should be null or point to a Swing windowmessage
- the messagetitle
- the message box's titlemessageType
- the type of the messagebuttonType
- specifies the buttons to be displayed- Gibt zurück:
- the pressed button
-
convertMessageType
protected int convertMessageType(int type) Converts the passed in message type into the corresponding type used byJOptionPane
.- Parameter:
type
- the type to be converted- Gibt zurück:
- the corresponding Swing constant
-
convertButtonType
protected int convertButtonType(int type) Converts the passed in button type into the corresponding option type used byJOptionPane
.- Parameter:
type
- the type to be converted- Gibt zurück:
- the corresponding Swing constant
-
convertReturnValue
protected int convertReturnValue(int value) Converts the passed in return value from theJOptionPane
to the correspondingRET_XXXX
constant.- Parameter:
value
- the return value from the option pane- Gibt zurück:
- the corresponding
RET_XXXX
constant
-
createOptionPane
protected JOptionPane createOptionPane(Window parent, Object message, String title, int messageType, int optionType) Creates the option pane dialog for displaying the message box.- Parameter:
parent
- the parent windowmessage
- the messagetitle
- the titlemessageType
- the message typeoptionType
- the option type- Gibt zurück:
- the option pane
-
showPane
Displays the given option pane. This method is called after the pane has been created and initialized.- Parameter:
pane
- the pane to displaydialog
- the dialog obtained from the option pane- Gibt zurück:
- the return value of the pane (indicating the option selected by the user)
-
createDialog
Creates the dialog from the option pane. This is the component that is to be displayed.- Parameter:
pane
- the option paneparent
- the parent componenttitle
- the dialog's title- Gibt zurück:
- the dialog to display
-