java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.HyperlinkListenerpublic class JMSwingText
extends javax.swing.JScrollPane
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, javax.swing.event.HyperlinkListener
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategyjava.awt.Container.AccessibleAWTContainer| Modifier and Type | Field | Description |
|---|---|---|
static int |
PAGEDOWN |
This variable indicates moving the scrollbars one "page" down.
|
static int |
PAGEUP |
This variable indicates moving the scrollbars one "page" up
|
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWcolumnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewportCOLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT| Constructor | Description |
|---|---|
JMSwingText() |
The constructor for JMSwingText.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addKeyListener(java.awt.event.KeyListener listener) |
Allow KeyListeners to be added to our JMSwingText.
|
void |
addMouseListener(java.awt.event.MouseListener mouse) |
We need to make our own mouse-listener that'll report back to any
listeners that may've registered to this component.
|
void |
append(java.lang.String inStr) |
Incoming text will be passed through this method to check to see if it
should be buffered or displayed
|
void |
buildColourAttr(int colAt) |
A method to sift through ANSI colour numbers and assign them to the
proper "area" (foreground, background, etc...)
|
int |
checkEscape(java.lang.String token,
int startPos) |
|
void |
clearScreen() |
Clear the text from the document.
|
boolean |
containsEscape(java.lang.String inStr) |
This method checks to see if the given string contains ESCAPE character
indicating an escape string that should be fully parsed before displaying
|
void |
copy() |
Copy any selected text to the system clipboard
|
java.lang.String[] |
escapeTokens(java.lang.String orig,
java.lang.String endStr) |
This method will return all the escape tokens and strip off the leading
escape characters and the ending string provided.
|
java.awt.Color |
getBackground() |
|
java.awt.Color[] |
getCurrentPalette() |
Return an array of colours representing our current palette
|
java.awt.Font |
getFont() |
|
java.awt.Color |
getForeground() |
|
java.lang.String |
getSelectedText() |
Return any texted that is currently selected
|
int |
getSelectionEnd() |
Return the index of the end of the selected text
|
int |
getSelectionStart() |
Return the index of the beginning of the selected text
|
java.awt.Color[] |
getStandardColours() |
Returns an array representing the "Standard" colours to be used.
|
java.lang.String |
getText() |
Return all of our text
|
void |
hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) |
Methods for handling hyper-links in text.
|
boolean |
isAntiAliasing() |
Return whether the current view has font anti-aliasing enabled or
disabled
|
boolean |
isBoldNotBright() |
This returns the state of our colour rendering, if we are using the 8
colour (bold) palette, or the 16 colour (bright) palette.
|
boolean |
isDestructiveResize() |
Returns whether destructive resizing is enabled
|
boolean |
isEditable() |
This returns whether the user can edit the JMSwingText area.
|
boolean |
isMarkLinks() |
This method returns whether URL marking has been enabled or not.
|
boolean |
isPaintBackground() |
Returns whether background painting is enabled.
|
void |
keyPressed(java.awt.event.KeyEvent event) |
Send out any key events to our listeners
|
void |
keyReleased(java.awt.event.KeyEvent event) |
Related our keyReleased event to our registered KeyListener
|
void |
keyTyped(java.awt.event.KeyEvent event) |
Pass our keyTyped events to our KeyListener
|
void |
linkFromArray(java.lang.String[] tokens) |
Create a link based on the supplied tokens
|
void |
mouseClicked(java.awt.event.MouseEvent event) |
Capture any mouse clicks so that we can snoop them if need be.
|
void |
mouseDragged(java.awt.event.MouseEvent event) |
Empty Event
|
void |
mouseEntered(java.awt.event.MouseEvent event) |
Empty event
|
void |
mouseExited(java.awt.event.MouseEvent event) |
Empty Event
|
void |
mouseMoved(java.awt.event.MouseEvent evt) |
Required event for mouseMoved
|
void |
mousePressed(java.awt.event.MouseEvent event) |
Empty Event
|
void |
mouseReleased(java.awt.event.MouseEvent event) |
Empty Event
|
void |
movePage(int direction) |
Move the scrollbars either one page up or one page down
|
void |
removeKeyListener(java.awt.event.KeyListener listener) |
Remove registered KeyListeners from our JMSwingText class
|
void |
removeMouseListener(java.awt.event.MouseListener mouse) |
Remove given mouse listener from this widget
|
void |
select(int start,
int end) |
Select text marked by the start and end integers
|
void |
setAntiAliasing(boolean status) |
Turn anti-aliasing of our letters on or off
|
void |
setBackground(java.awt.Color newColour) |
Set the background colour of our text area
|
void |
setBoldNotBright(boolean state) |
There are two different ways to interpret the "bold" feature on
MU*'linkStyle.
|
void |
setDestructiveResize(boolean state) |
This method enables "destructive" resizing of fonts.
|
void |
setEditable(boolean state) |
This sets the text area editable or non-editable.
|
void |
setFont(java.awt.Font newFont) |
Set the font to be used in our display.
|
void |
setForeground(java.awt.Color newColour) |
Set the foreground (text) colour of our display
|
void |
setMarkLinks(boolean status) |
This method enables the marking of web links, usually with an underline
|
void |
setPaintBackground(boolean state) |
Tell us whether it is alright to paint the background colour or not.
|
void |
setPalette(java.awt.Color[] newPal) |
Sets an entirely new colour palette based on the array given.
|
void |
setSelectionEnd(int end) |
This method sets the end point of a selection
|
void |
setSelectionStart(int start) |
Sets the index for the beginning of a selected area
|
void |
setStandardPalette() |
Sets colours in the output window to the ones listed in the
getStandardPalette method
|
void |
setText(java.lang.String initialText) |
Sets the text to be displayed.
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleadd, 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, transferFocusDownCycle, validate, validateTreeaddAncestorListener, 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, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updatecreateHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUIpublic static final int PAGEUP
public static final int PAGEDOWN
public JMSwingText()
public void setEditable(boolean state)
state - true sets the text area editable.
false sets the text area non-editable.public boolean isEditable()
true The JMSwingText component is editable
false The JMSwingText component is read-onlypublic int checkEscape(java.lang.String token,
int startPos)
token - startPos - public void buildColourAttr(int colAt)
colAt - The ANSI colour code to be processed by this methodpublic void setPaintBackground(boolean state)
state - true indicates we should handle painting the
background colour false indicates we should not paint the
background colour ourselvespublic boolean isPaintBackground()
true Background painting is enabled
false Background painting is not enabledpublic void setForeground(java.awt.Color newColour)
setForeground in class javax.swing.JComponentnewColour - The colour to set our foreground (text)public java.awt.Color getForeground()
getForeground in class java.awt.Componentpublic void setBackground(java.awt.Color newColour)
setBackground in class javax.swing.JComponentnewColour - The colour to set our backgroundpublic java.awt.Color getBackground()
getBackground in class java.awt.Componentpublic java.awt.Font getFont()
getFont in class java.awt.Componentpublic void setFont(java.awt.Font newFont)
setFont in class javax.swing.JComponentnewFont - The java.awt.Font to use for our displaypublic java.lang.String getText()
public void setText(java.lang.String initialText)
initialText - public java.lang.String getSelectedText()
public void select(int start,
int end)
start - The starting point of our selection. This number is the
count of characters from the beginning of our entire text.end - The end point of our selection. This number is the count of
characters from the beginning of our text.public void addMouseListener(java.awt.event.MouseListener mouse)
addMouseListener in class java.awt.Componentmouse - The mouselistener for this widgetpublic void removeMouseListener(java.awt.event.MouseListener mouse)
removeMouseListener in class java.awt.Componentmouse - The mouselistener to removepublic void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked in interface java.awt.event.MouseListenerevent - The captured mouse eventpublic void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered in interface java.awt.event.MouseListenerevent - Mouse Eventpublic void mouseExited(java.awt.event.MouseEvent event)
mouseExited in interface java.awt.event.MouseListenerevent - Mouse Eventpublic void mousePressed(java.awt.event.MouseEvent event)
mousePressed in interface java.awt.event.MouseListenerevent - Mouse Eventpublic void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased in interface java.awt.event.MouseListenerevent - Mouse Eventpublic void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged in interface java.awt.event.MouseMotionListenerevent - Mouse Eventpublic void mouseMoved(java.awt.event.MouseEvent evt)
mouseMoved in interface java.awt.event.MouseMotionListenerevt - Mouse Eventpublic void addKeyListener(java.awt.event.KeyListener listener)
addKeyListener in class java.awt.Componentlistener - The listener to be addedpublic void removeKeyListener(java.awt.event.KeyListener listener)
removeKeyListener in class java.awt.Componentlistener - The KeyListener to be removedpublic void keyPressed(java.awt.event.KeyEvent event)
keyPressed in interface java.awt.event.KeyListenerevent - The received keyPressed eventpublic void keyReleased(java.awt.event.KeyEvent event)
keyReleased in interface java.awt.event.KeyListenerevent - received KeyEventpublic void keyTyped(java.awt.event.KeyEvent event)
keyTyped in interface java.awt.event.KeyListenerevent - Our KeyEventpublic void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt)
hyperlinkUpdate in interface javax.swing.event.HyperlinkListenerevt - Hyperlink eventpublic void setAntiAliasing(boolean status)
status - The variable that tells us to either turn on anti-aliasing
with true, or turn off anti-aliasing with
false.public boolean isAntiAliasing()
true anti-aliasing is enabled false
anti-aliasing is disabledpublic void copy()
public void setBoldNotBright(boolean state)
state - true - Create the characters as bold, using a
limited palette false - Use the 16 colour palatte instead of
bolding characterspublic boolean isBoldNotBright()
true - We are using the 8 colour (bold) palette
false - We are using the 16 colour (bright) palettepublic void setDestructiveResize(boolean state)
state - true Enable destructive resizing
false Disable destructive resizingpublic boolean isDestructiveResize()
true destructive resizing is enabled
false destructive resizing is not enabledpublic void movePage(int direction)
direction - PAGEDOWN - move the scrollbars one page
down
PAGEUP - move the scrollbars one page uppublic java.awt.Color[] getCurrentPalette()
public void setPalette(java.awt.Color[] newPal)
newPal - An array of colours to be used.public void setStandardPalette()
public java.awt.Color[] getStandardColours()
public int getSelectionStart()
public int getSelectionEnd()
public void setSelectionStart(int start)
start - index to begin the selectionpublic void setSelectionEnd(int end)
end - the index to end the current selectionpublic void clearScreen()
public void setMarkLinks(boolean status)
status - true Enable link marking (default)
false disable link markingpublic boolean isMarkLinks()
true link marking is enabled false link
marking is disabledpublic boolean containsEscape(java.lang.String inStr)
inStr - The string to check for escape characterstrue - The given string does contain an escape
sequence. false - The given string does not contain an
escape sequence.public void append(java.lang.String inStr)
inStr - public java.lang.String[] escapeTokens(java.lang.String orig,
java.lang.String endStr)
orig - The token string to be parsedendStr - public void linkFromArray(java.lang.String[] tokens)
tokens -