public class DefaultMessageArea extends javax.swing.JPanel implements SwingMessageArea
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultMessageArea.HtmlSelection |
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
protected StylableSizableArea |
area
The stylable area.
|
protected javax.swing.AbstractAction |
clearAction
The clear action.
|
protected javax.swing.AbstractAction |
copyAction
The copy to clipboard action.
|
static int |
DEFAULT_ROWS
Default height of the Message Area.
|
protected javax.swing.text.html.HTMLDocument |
doc
The HTMLDocument used by the area.
|
protected javax.swing.JFrame |
frame
The parent frame.
|
protected java.util.List<MessageAreaHandler> |
handlers
The message area handler.
|
protected static java.util.regex.Pattern |
HYPERLINK_PAT |
protected boolean |
hyperLinkActivated
True if the hyperlink was activated.
|
protected javax.swing.text.html.HTMLEditorKit |
kit
The editor kit.
|
protected javax.swing.AbstractAction |
printAction
The print action.
|
protected javax.swing.AbstractAction |
saveAction
The save action.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDEFAULT_MAXIMUM_LINESBOLD, CROSSED, DEFAULT_FONT_SIZE, DEFAULT_STYLE, ITALIC, UNDERLINE| Constructor and Description |
|---|
DefaultMessageArea()
Create a new MessageArea.
|
DefaultMessageArea(java.awt.Component parent)
Create a new MessageArea, with a default number of rows.
|
DefaultMessageArea(java.awt.Component parent,
int rows)
Create a new MessageArea.
|
DefaultMessageArea(java.awt.Component parent,
int rows,
boolean isEditableMessageArea)
Create a new MessageArea.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(MessageAreaHandler handler)
Add the handler which will be fired after Hyperlink selections in the area.
|
void |
append(java.lang.String txt)
Append a line of text in the message area.
|
void |
append(java.lang.String txt,
long time)
Append a line of text in the message area.
|
void |
append(java.lang.String txt,
java.lang.String htmlColor)
Append a line of text in the message area.
|
void |
append(java.lang.String txt,
java.lang.String htmlColor,
int fontSize,
int style)
Append a line of text in the message area.
|
void |
appendLink(java.lang.String txt,
java.lang.String linkID)
Append a line of text with an hyperlink in the message area.
|
void |
appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.Object o)
Append a line of text with an hyperlink in the message area.The link can be any text without space, and can be used as desired by the
application.
|
void |
appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.String htmlColor)
Append a line of text with an hyperlink in the message area.
|
void |
appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.String htmlColor,
int fontSize,
int style)
Append a line of text with an hyperlink in the message area.
|
void |
appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.String htmlColor,
java.lang.Object o)
Append a line of text with an hyperlink in the message area.
|
protected void |
appendText(java.lang.String text)
Append a line of text, considering the possible number of lines limitation.
|
void |
clear()
Clear the content of the message area and resize it accordingly.
|
void |
copyToClipboard()
Copy the hightlighted text to the system clipboard.
|
int |
getMaximumLines()
Return the maximum lines to be displayed, or -1 if there is no limitation.
|
MessageAreaHandler |
getMessageAreaHandler()
Return the first message area handler.
|
java.util.List<MessageAreaHandler> |
getMessageAreaHandlers()
Return the message area handlers.
|
boolean |
hasMaximumLines()
Return true if the number of lines to be displayed is limited.
|
protected boolean |
hasSelectedText()
Return true if some text has been highlighted.
|
protected void |
initDocument()
Initialize the document.
|
protected void |
initializeHTMLContent(int rows)
Initialize the HTML content.
|
protected void |
initializePopupMenu()
Initialize the Popup menu.
|
boolean |
isHandlingRightClick()
Return true if the message area is handling right clicks.
|
boolean |
isManagingClipBoard()
True if the area is managing the clipboard.
|
boolean |
isSavingAreaLines()
Return true if there is a popup menu action to save the lines as text.
|
void |
manageClipBoard(boolean manageClipboard)
Set if the area is managing the clipboard.
|
protected void |
print()
Called when the "print" action is called.
|
void |
print(java.io.File file)
Print the content of the area in a html file.
|
protected void |
resize()
Resize the area.
|
protected void |
save()
Called when the "save" action is called.
|
void |
save(java.io.File file)
Save the content of the area in a file.
|
void |
saveAreaLines(boolean save)
Set if there is a popup menu action to save the lines as text.
|
void |
setHandler(MessageAreaHandler handler)
Deprecated.
|
void |
setHandleRightClick(boolean isHandlingRightClick)
Set if the message area is handling right clicks.
|
void |
setMaximumLines(int maximumLines)
Set the maximum of lines which are accepted in this message Area.
|
void |
setMaximumLinesBehavior(boolean hasMaximumLines)
Set the behavior concerning the maximum number of lines which are accepted in this message Area.
|
void |
setParent(java.awt.Component parent,
int rows)
Set the parent component
|
void |
setStyleSheet(javax.swing.text.html.StyleSheet styleSheet)
Set the StyleSheet used on the document.
|
protected void |
showPopupMenu(int x,
int y)
Create the message area Popup menu.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetHandler, isEditableappendErrorprotected StylableSizableArea area
protected javax.swing.text.html.HTMLDocument doc
protected javax.swing.text.html.HTMLEditorKit kit
protected javax.swing.JFrame frame
protected boolean hyperLinkActivated
protected java.util.List<MessageAreaHandler> handlers
protected static final java.util.regex.Pattern HYPERLINK_PAT
protected javax.swing.AbstractAction clearAction
protected javax.swing.AbstractAction copyAction
protected javax.swing.AbstractAction printAction
protected javax.swing.AbstractAction saveAction
public static final int DEFAULT_ROWS
public DefaultMessageArea()
public DefaultMessageArea(java.awt.Component parent)
parent - the parentpublic DefaultMessageArea(java.awt.Component parent,
int rows)
parent - the parent componentrows - the number of rows of this areapublic DefaultMessageArea(java.awt.Component parent,
int rows,
boolean isEditableMessageArea)
parent - the parent componentrows - the number of rows of this areaisEditableMessageArea - true if the message area is editablepublic void saveAreaLines(boolean save)
saveAreaLines in interface SwingMessageAreasave - true if there is a popup menu action to save the lines as textpublic boolean isSavingAreaLines()
isSavingAreaLines in interface SwingMessageAreapublic void addHandler(MessageAreaHandler handler)
addHandler in interface MessageArea<java.awt.Component>handler - the handler@Deprecated public void setHandler(MessageAreaHandler handler)
setHandler in interface MessageArea<java.awt.Component>handler - the handlerpublic MessageAreaHandler getMessageAreaHandler()
getMessageAreaHandler in interface MessageArea<java.awt.Component>public java.util.List<MessageAreaHandler> getMessageAreaHandlers()
getMessageAreaHandlers in interface MessageArea<java.awt.Component>public void manageClipBoard(boolean manageClipboard)
manageClipBoard in interface MessageArea<java.awt.Component>manageClipboard - true if the area is managing the clipboardpublic boolean isManagingClipBoard()
isManagingClipBoard in interface MessageArea<java.awt.Component>public void setHandleRightClick(boolean isHandlingRightClick)
setHandleRightClick in interface SwingMessageAreaisHandlingRightClick - if the message area is handling right clickspublic boolean isHandlingRightClick()
isHandlingRightClick in interface MessageArea<java.awt.Component>public void setMaximumLines(int maximumLines)
setMaximumLines in interface MessageArea<java.awt.Component>maximumLines - the maximum of linespublic void setMaximumLinesBehavior(boolean hasMaximumLines)
setMaximumLines(int) with a value of 500 linessetMaximumLines(int) with a value of -1setMaximumLinesBehavior in interface MessageArea<java.awt.Component>hasMaximumLines - true if the number of lines to be displayed is limitedpublic int getMaximumLines()
getMaximumLines in interface MessageArea<java.awt.Component>public boolean hasMaximumLines()
hasMaximumLines in interface MessageArea<java.awt.Component>protected void initializePopupMenu()
public void setParent(java.awt.Component parent,
int rows)
setParent in interface MessageArea<java.awt.Component>parent - the parent componentrows - the number of rowsprotected void initializeHTMLContent(int rows)
initDocument() method an adds a listener on hyperlinks activation.rows - the number of rows.protected void resize()
public void clear()
clear in interface MessageArea<java.awt.Component>protected boolean hasSelectedText()
public void copyToClipboard()
copyToClipboard in interface MessageArea<java.awt.Component>protected void print()
protected void save()
public void print(java.io.File file)
print in interface MessageArea<java.awt.Component>file - the filepublic void save(java.io.File file)
save in interface MessageArea<java.awt.Component>file - the filepublic void setStyleSheet(javax.swing.text.html.StyleSheet styleSheet)
setStyleSheet in interface SwingMessageAreastyleSheet - the StyleSheetprotected void initDocument()
HTMLDocument which will be used in the area.protected void showPopupMenu(int x,
int y)
x - the x position of the menuy - the y position of the menupublic void append(java.lang.String txt)
append in interface MessageLoggertxt - the textpublic void append(java.lang.String txt,
long time)
append in interface MessageLoggertxt - the text to showtime - the timepublic void append(java.lang.String txt,
java.lang.String htmlColor)
append in interface MessageLoggertxt - the text to showhtmlColor - the html-define color to use for the textpublic void append(java.lang.String txt,
java.lang.String htmlColor,
int fontSize,
int style)
append in interface MessageLoggertxt - the text to showhtmlColor - the html-defined color to use for the textfontSize - the text font sizestyle - the text stylepublic void appendLink(java.lang.String txt,
java.lang.String linkID)
appendLink in interface MessageLoggerappendLink in interface MessageArea<java.awt.Component>txt - the text to showlinkID - the linkpublic void appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.Object o)
appendLink in interface MessageArea<java.awt.Component>txt - the text to showlinkID - the linko - the object associated with the linkpublic void appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.String htmlColor)
appendLink in interface MessageLoggerappendLink in interface MessageArea<java.awt.Component>txt - the text to showlinkID - the linkhtmlColor - the html-define color to use for the textpublic void appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.String htmlColor,
java.lang.Object o)
appendLink in interface MessageArea<java.awt.Component>txt - the text to showlinkID - the linkhtmlColor - the html-define color to use for the texto - the object associated with the linkpublic void appendLink(java.lang.String txt,
java.lang.String linkID,
java.lang.String htmlColor,
int fontSize,
int style)
appendLink in interface MessageLoggertxt - the text to showlinkID - the linkhtmlColor - the html-define color to use for the textfontSize - the text font sizestyle - the text styleprotected void appendText(java.lang.String text)
text - the text