|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.TextComponent
java.awt.TextArea
cynosurex.awt.EnhancedTextArea
public class EnhancedTextArea
EnhancedTextArea enhances the standard TextArea class by creating a multithreaded TextArea to calculate the current line and column position. The thread is set to minimum priority, sleeps, and only wakes up to do the calculation when the cursor position changes.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.TextArea |
---|
java.awt.TextArea.AccessibleAWTTextArea |
Nested classes/interfaces inherited from class java.awt.TextComponent |
---|
java.awt.TextComponent.AccessibleAWTTextComponent |
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 |
PATCH_1_1
|
static int |
PATCH_1_5
|
static int |
PATCH_NONE
|
static int |
PATCH_UNDEFINED
|
Fields inherited from class java.awt.TextArea |
---|
SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY |
Fields inherited from class java.awt.TextComponent |
---|
textListener |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface cynosurex.internal.CommonInterface |
---|
copyright, copyrightYears, notice, program, version |
Fields inherited from interface cynosurex.internal.AuthorCommon |
---|
author, copyrightSymbol, noticeMsg, rights |
Fields inherited from interface cynosurex.internal.CompanyCommon |
---|
company, email, website |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
EnhancedTextArea()
Constructor to create an EnhancedTextArea. |
|
EnhancedTextArea(int row,
int col)
Constructor to create an EnhancedTextArea with the specified row(s) and column(s). |
|
EnhancedTextArea(java.lang.String str)
Constructor to create an EnhancedTextArea with the specified String. |
|
EnhancedTextArea(java.lang.String str,
int row,
int col)
Constructor to create an EnhancedTextArea with the specified String, row(s), and column(s). |
|
EnhancedTextArea(java.lang.String str,
int row,
int col,
int scroll)
|
Method Summary | |
---|---|
int |
getCaretColPosition()
This method returns the current caret column position. |
int |
getCaretRowPosition()
This method returns the current caret row position. |
java.lang.Integer |
getNumOfCharacters()
This method returns the number of characters (including all white space) in the text area. |
java.lang.Integer |
getNumOfLines()
This method returns the number of lines in the text area. |
java.lang.Integer |
getNumOfWords()
This method returns the number of words (separated by white space) in the text area. |
int |
getSelectionEnd()
This method overrides the method in the super class. |
int |
getSelectionStart()
This method overrides the method in the super class. |
int[] |
getSelectionStartAndEnd()
This method returns the text selection start and end in an integer array with two elements. |
int |
getTextSelectionPatch()
This method returns the text selection patch that is in use. |
void |
insert(java.lang.String text)
Inserts text at the current caret position. |
void |
insert(java.lang.String str,
int pos)
Inserts the specified text at the specified position in this text area. |
void |
replaceRange(java.lang.String str,
int start,
int end)
Replaces text between the indicated start and end positions with the specified replacement text. |
void |
run()
This method is called by the EnhancedTextArea thread to update the current position of the cursor. |
void |
select(int start,
int end)
|
void |
setCaretPosition(int row,
int col)
This method sets the caret row and column position. |
void |
setCaretPosition(Position p)
This method sets the caret row and column position. |
void |
setTextSelectionPatch(int patch)
The Java 1.1 API introduced a bug in the TextArea class, which return the wrong text selection position on OS using both carriage-return and line-feed characters. |
Methods inherited from class java.awt.TextArea |
---|
addNotify, append, appendText, getAccessibleContext, getColumns, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, getRows, getScrollbarVisibility, insertText, minimumSize, minimumSize, paramString, preferredSize, preferredSize, replaceText, setColumns, setRows |
Methods inherited from class java.awt.TextComponent |
---|
addTextListener, enableInputMethods, getBackground, getCaretPosition, getInputMethodRequests, getListeners, getSelectedText, getText, getTextListeners, isEditable, processEvent, processTextEvent, removeNotify, removeTextListener, selectAll, setBackground, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart, setText |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PATCH_NONE
public static final int PATCH_1_1
public static final int PATCH_1_5
public static final int PATCH_UNDEFINED
Constructor Detail |
---|
public EnhancedTextArea()
public EnhancedTextArea(java.lang.String str)
str
- the string to be displayed in the text areapublic EnhancedTextArea(int row, int col)
row
- row(s) of the initial text areacol
- column(s) of the initial text areapublic EnhancedTextArea(java.lang.String str, int row, int col)
str
- the string to be displayed in the text arearow
- row(s) of the initial text areacol
- column(s) of the initial text areapublic EnhancedTextArea(java.lang.String str, int row, int col, int scroll)
Method Detail |
---|
public int getCaretColPosition()
public int getCaretRowPosition()
public java.lang.Integer getNumOfCharacters()
public java.lang.Integer getNumOfLines()
public java.lang.Integer getNumOfWords()
public int getSelectionStart()
getSelectionStart
in class java.awt.TextComponent
getTextSelectionPatch()
,
setTextSelectionPatch(int)
public int getSelectionEnd()
getSelectionEnd
in class java.awt.TextComponent
getTextSelectionPatch()
,
setTextSelectionPatch(int)
public int[] getSelectionStartAndEnd()
getTextSelectionPatch()
,
setTextSelectionPatch(int)
public int getTextSelectionPatch()
setTextSelectionPatch(int)
public void insert(java.lang.String text)
public void insert(java.lang.String str, int pos)
insert
in class java.awt.TextArea
public void replaceRange(java.lang.String str, int start, int end)
replaceRange
in class java.awt.TextArea
public void run()
run
in interface java.lang.Runnable
public void select(int start, int end)
select
in class java.awt.TextComponent
public void setCaretPosition(Position p)
p
- position to set the caretpublic void setCaretPosition(int row, int col)
row
- row to set the caretcol
- column to set the caretpublic void setTextSelectionPatch(int patch)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |