|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JScrollPane
anecho.gui.JMSwingText
public class JMSwingText
JMSwingText, a Swing-based text area for ANSI colours (originally developed for JamochaMUD)
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JScrollPane |
|---|
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
PAGEDOWN
This variable indicates moving the scrollbars one "page" down. |
static int |
PAGEUP
This variable indicates moving the scrollbars one "page" up |
| Fields inherited from class javax.swing.JScrollPane |
|---|
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.ScrollPaneConstants |
|---|
COLUMN_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 |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JMSwingText()
The constructor for JMSwingText. |
|
| Method Summary | |
|---|---|
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 rawInput)
Append text to our JMSwingText. |
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)
Here, we check for an ANSI colour escape in the 'token', starting at position 'i'. |
void |
clearScreen()
Clear the text from the document. |
void |
copy()
Copy any selected text to the system clipboard |
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()
|
boolean |
getMarkLinks()
This method returns whether URL marking has been enabled or not. |
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 |
isEditable()
This returns whether the user can edit the JMSwingText area. |
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 |
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*'s. |
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. |
| Methods inherited from class javax.swing.JScrollPane |
|---|
createHorizontalScrollBar, 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, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, update |
| Methods inherited from class java.awt.Container |
|---|
add, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int PAGEUP
public static final int PAGEDOWN
| Constructor Detail |
|---|
public JMSwingText()
| Method Detail |
|---|
public void append(java.lang.String rawInput)
rawInput - The input to be added to the current JMSwingText area.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-only
public int checkEscape(java.lang.String token,
int startPos)
token - is a string that is to be checked to see if it is an ANSI colour escapestartPos - is the starting position of the token, incase the token is more than an "escape"
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 interface java.awt.MenuContainergetFont 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)
event - Mouse Eventpublic void mouseMoved(java.awt.event.MouseEvent evt)
evt - 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 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 getMarkLinks()
true link marking is enabled
false link marking is disabled
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||