public final class SwingMessagePane extends Object implements org.jdtaus.core.text.MessageListener
MessageListener
displaying messages using Swing's JOptionPane
.
This implementation displays a dialog for each MessageEvent
this MessageListener
is notified
about. Since a MessageEvent
can hold multiple messages a maximum number of messages to display per event
can be specified by property maximumMessages
(defaults to 25).
onMessage(MessageEvent)
Constructor and Description |
---|
SwingMessagePane(Component parent)
Creates a new
SwingMessagePane instance taking the parent component to use when displaying messages. |
SwingMessagePane(Component parent,
int maximumMessages)
Creates a new
SwingMessagePane instance taking the parent component to use when displaying messages and
the maximum number of messages displayed per event. |
SwingMessagePane(Component parent,
int maximumMessages,
int columns)
Creates a new
SwingMessagePane instance taking the parent component to use when displaying messages, the
maximum number of messages displayed per event and a number of columns to compute the preferred width of the
message pane with. |
SwingMessagePane(Component parent,
int maximumMessages,
int columns,
boolean resizable)
Creates a new
SwingMessagePane instance taking the parent component to use when displaying messages, the
maximum number of messages displayed per event, a number of columns to compute the preferred width of the
message pane with and a flag indicating the message pane is resizable. |
Modifier and Type | Method and Description |
---|---|
int |
getColumns()
Gets the number of columns the preferred width of the message pane is computed with.
|
int |
getMaximumMessages()
Gets the maximum number of messages displayed per event.
|
Component |
getParent()
Gets the parent component for any message displays.
|
boolean |
isResizable()
Gets a flag indicating the message pane is resizable.
|
void |
onMessage(org.jdtaus.core.text.MessageEvent event)
This method uses Swing's
JOptionPane to display messages given by the event. |
void |
setParent(Component parent)
Sets the parent component used by any message displays.
|
public SwingMessagePane(Component parent)
SwingMessagePane
instance taking the parent component to use when displaying messages.parent
- The parent component to use when displaying messages.NullPointerException
- if parent
is null
.HeadlessException
- if this class is used in an environment not providing a keyboard, display, or mouse.public SwingMessagePane(Component parent, int maximumMessages)
SwingMessagePane
instance taking the parent component to use when displaying messages and
the maximum number of messages displayed per event.parent
- The parent component to use when displaying messages.maximumMessages
- Maximum number of messages displayed per event.NullPointerException
- if parent
is null
.HeadlessException
- if this class is used in an environment not providing a keyboard, display, or mouse.public SwingMessagePane(Component parent, int maximumMessages, int columns)
SwingMessagePane
instance taking the parent component to use when displaying messages, the
maximum number of messages displayed per event and a number of columns to compute the preferred width of the
message pane with.parent
- The parent component to use when displaying messages.maximumMessages
- Maximum number of messages displayed per event.columns
- Number of columns the preferred width of the message pane should be computed with.NullPointerException
- if parent
is null
.HeadlessException
- if this class is used in an environment not providing a keyboard, display, or mouse.public SwingMessagePane(Component parent, int maximumMessages, int columns, boolean resizable)
SwingMessagePane
instance taking the parent component to use when displaying messages, the
maximum number of messages displayed per event, a number of columns to compute the preferred width of the
message pane with and a flag indicating the message pane is resizable.parent
- The parent component to use when displaying messages.maximumMessages
- Maximum number of messages displayed per event.columns
- Number of columns the preferred width of the message pane should be computed with.resizable
- true
, if the message pane should be resizable; false
if the message pane should
have a fixed size.NullPointerException
- if parent
is null
.HeadlessException
- if this class is used in an environment not providing a keyboard, display, or mouse.public void onMessage(org.jdtaus.core.text.MessageEvent event)
This method uses Swing's JOptionPane
to display messages given by the event. It will block the event
dispatch thread until the user confirms the message pane.
onMessage
in interface org.jdtaus.core.text.MessageListener
event
- The event holding messages.public Component getParent()
public void setParent(Component parent)
parent
- the parent component used by any message displays.NullPointerException
- if parent
is null
.public int getMaximumMessages()
public int getColumns()
public boolean isResizable()
true
, if the message pane is resizable; false
if the message pane is not resizable.Copyright © 2005-2012 jDTAUS. All Rights Reserved.