|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.text.JTextComponent | +--javax.swing.JEditorPane | +--com.borland.primetime.editor.EditorPane
This is the editor component for the PrimeTime framework. The EditorPane is the focused component when the user is typing into the editor, thus it is responsible for sending keys to the current keymap. In addition, the EditorPane also does some undo management, as well as providing a facility for emphasizing particular lines through a highlight mark and temporary mark facility.
The EditorPane uses an EditorDocument class as the model, and an EditorView class as the view (to do the actual rendering of the text).
Through this component, other systems can call the editor APIs to manipulate the text contained in this component.
EditorPane
,
EditorDocument
, Serialized FormInner Class Summary | |
static class |
EditorPane.HighlightMark
This is the highlight mark, placed on a line within the editor (through the document) to emphasize that line. |
Inner classes inherited from class javax.swing.JEditorPane |
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport |
Inner classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
static int |
CENTER_ALWAYS
Used in gotoLine and gotoOffset. |
static int |
CENTER_IF_NEAR_EDGE
Used in gotoLine and gotoOffset. |
static int |
CENTER_IF_OFFSCREEN
Used in gotoLine and gotoOffset. |
static int |
CENTER_NEVER
Deprecated. Use ONSCREEN instead. |
protected java.lang.ref.WeakReference |
editorRef
A weak reference is needed in LineMark objects for instance. |
protected int |
fontHeight
|
protected java.awt.FontMetrics |
fontMetrics
|
protected int |
fontWidth
|
protected EditorPane.HighlightMark |
highlightMark
The highlight mark usually used for the temporary mark. |
ModalKeymap.ModeStateInfo |
keymapStateInfo
This member records information specific to a particular keymap, including state info. |
protected javax.swing.Action |
lastAction
This member records the last Action object executed on this editor instance. |
static int |
LINE_PADDING
|
static int |
NOT_OUT_OF_BOUNDS
Used in gotoLine and gotoOffset. |
static int |
ONETHIRD_ALWAYS
Used in gotoLine and gotoOffset. |
static int |
ONETHIRD_IF_NEAR_EDGE
Used in gotoLine and gotoOffset. |
static int |
ONETHIRD_IF_OFFSCREEN
Used in gotoLine and gotoOffset. |
static int |
ONSCREEN
Used in gotoLine and gotoOffset. |
protected boolean |
popupEnabled
The flag that remembers if there is a current popup in the editor. |
boolean |
processedKeyPressed
Flag to indicate if the KeyPressed event has been processed after a key is entered. |
protected LineMark |
temporaryMark
The temporary mark used to highlight lines when entries in the structure pane are choosen. |
protected static ToolTipProvider |
toolTipProvider
The editor will delegate to this object when it is asked for ToolTipText |
static int |
TWOTHIRD_ALWAYS
Used in gotoLine and gotoOffset. |
static int |
TWOTHIRD_IF_NEAR_EDGE
Used in gotoLine and gotoOffset. |
static int |
TWOTHIRD_IF_OFFSCREEN
Used in gotoLine and gotoOffset. |
Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
EditorPane()
Constructs a new EditorPane. |
Method Summary | |
int |
calcCaretPosition(int lineNumber,
int column)
Calculcate the caret position for a particular line and column of the the document. |
boolean |
canRedo()
Check to see if we can redo in this editor. |
boolean |
canUndo()
Check to see if we can undo in this editor. |
void |
clearHighlight()
Clear the highlight. |
void |
clearTemporaryMark()
Clear the temporary mark. |
void |
deleteNextChar()
This method deletes the character immediately after the caret. |
void |
deletePrevChar()
This method deletes the character immediately before the caret. |
void |
endUndoGroup()
End the active undo group. |
void |
endUndoSegment()
End the active undo segment. |
void |
focusGained(java.awt.event.FocusEvent e)
Called when this editor gains focus. |
void |
focusLost(java.awt.event.FocusEvent e)
Called when this editor loses focus. |
int |
getColumnNumber(int p0)
Get the 1-based column number containing a particular position in the document. |
int |
getFontHeight()
Return the height of the current font. |
java.awt.FontMetrics |
getFontMetrics()
Return the FontMetrics of the current font. |
int |
getFontWidth()
Return the width of the current font. |
ModalKeymap.ModeStateInfo |
getKeymapStateInfo()
Get the state info object associated with this editor instance. |
javax.swing.Action |
getLastAction()
Get the last action executed in this editor pane. |
int |
getLineCount()
Get the number of lines in the document. |
int |
getLineNumber(int p0)
Get the 1-based line number containing a particular position in the document. |
java.awt.Dimension |
getPreferredSize()
Gets the preferred size of this component. |
java.lang.ref.WeakReference |
getReference()
For other objects that want a weak reference link to the editor pane. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Override this method so that vertical block scrolling will scroll one page at a time (determined by fontHeight), and that horizontal scrolling will scroll by the visible horizontal width. |
boolean |
getScrollableTracksViewportWidth()
Return false here to allow horizontal scrolling. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Override this method so that vertical unit scrolling will scroll one line at a time (determined by fontHeight), and that horizontal scrolling will scroll by 10% of the visible horizontal width. |
java.lang.String |
getTextLine(int lineNumber)
Get the text contained in a particular line in the document. |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent e)
Get the text which should be displayed in a tooltip. |
int |
getTopLine()
Get the number of the line at the top of the editor viewport. |
void |
gotoLine(int lineNumber)
Go to a particular line in the document. |
void |
gotoLine(int lineNumber,
boolean highlight)
Go to a particular line in the document. |
void |
gotoLine(int lineNumber,
boolean highlight,
int centerPolicy)
Go to a particular line in the document. |
void |
gotoOffset(int p0)
Go to a particular offset within the document. |
void |
gotoOffset(int p0,
boolean highlight)
Go to a particular offset within the document. |
void |
gotoOffset(int p0,
boolean highlight,
int centerPolicy)
Go to a particular offset within the document. |
void |
gotoOffset(int p0,
boolean highlight,
int centerPolicy,
int topHiddenLine,
int bottomHiddenLine)
Specialized version of gotoOffset(...) which will try to avoid a certain region on the screen as defined by the topHiddenLine and bottomHiddenLine parameters. |
void |
gotoPosition(int line,
int column)
Go to a particular line and column position within the document. |
void |
gotoPosition(int line,
int column,
boolean highlight)
Go to a particular line and column position within the document. |
void |
gotoPosition(int line,
int column,
boolean highlight,
int centerPolicy)
Go to a particular line and column position within the document. |
void |
insertAt(int lineNumber,
int column,
java.lang.String text)
This is a convenience method to insert text at a particular position in the document. |
void |
insertAt(int p0,
java.lang.String text)
This is a convenience method to insert text at a particular position in the document. |
void |
insertChar(java.lang.String content)
This method inserts the text in content (usually a single character) immediately after the caret. |
boolean |
isPopupEnabled()
See if we can bring up a popup window in the editor's current state. |
void |
overwriteChar(java.lang.String content)
This method deletes the character immediately after the caret, replacing it with the text in content (usually a single character). |
void |
paste()
Transfers the contents of the system clipboard into the associated text model. |
protected void |
positionCaret(int point,
int mark)
Position the caret point and mark. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
This function is called by the EditorManager when a property has changed. |
void |
redo()
Cause a redo in this editor. |
void |
redo(boolean checkPosition)
Cause a redo in this editor. |
static void |
registerToolTipProvider(ToolTipProvider provider)
Register a tooltip provider for all editors to use. |
void |
release()
|
void |
repaintLine(int lineNumber)
Repaints a particular line of the document. |
void |
replaceSelection(java.lang.String content)
This method replaces the current selection with the text in content. |
void |
selectCharacters(int numChars)
This is a convenience method used to select a number of characters from the current caret offset. |
void |
setCaret(javax.swing.text.Caret c)
Set a new Caret for this EditorPane. |
void |
setCaretPosition(int lineNumber,
int column)
Set the caret to a particular line and column within the document. |
void |
setFont(java.awt.Font f)
Sets the font of this component. |
void |
setHighlight(int lineNumber)
Set the highlight to a particular line number. |
void |
setLastAction(javax.swing.Action action)
Set the last action executed in this editor pane. |
void |
setPopupEnabled(boolean enabled)
Set the editor to enable or disable popup windows. |
void |
setTemporaryMark(int lineNumber,
LineMark mark)
Set a temporary mark on a particular line number. |
void |
setTopLine(int lineNumber)
Set the indicated line number to be the first line visible in the in the editor viewport. |
void |
startUndoGroup()
Start an undo group. |
void |
startUndoSegment(int type)
Start an undo segment. |
void |
undo()
Cause an undo in this editor. |
void |
undo(boolean checkPosition)
Cause an undo in this editor. |
void |
updateColors()
Update the colors using the default style context supplied by the editor manager. |
void |
updateColors(javax.swing.text.StyleContext context)
Update the colors using the supplied style context. |
void |
updateUI()
This method is overridden to reset the keymap and colors after the UI is changed. |
Methods inherited from class javax.swing.JEditorPane |
addHyperlinkListener, createDefaultEditorKit, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getPage, getScrollableTracksViewportHeight, getStream, getText, getUIClassID, isFocusCycleRoot, isManagingFocus, paramString, processComponentKeyEvent, processKeyEvent, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage, setText |
Methods inherited from class javax.swing.text.JTextComponent |
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretPosition, getDisabledTextColor, getDocument, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getPreferredScrollableViewportSize, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getUI, isEditable, isFocusTraversable, loadKeymap, modelToView, moveCaretPosition, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaretColor, setCaretPosition, setDisabledTextColor, setDocument, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, viewToModel, write |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processFocusEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static ToolTipProvider toolTipProvider
protected EditorPane.HighlightMark highlightMark
protected LineMark temporaryMark
public boolean processedKeyPressed
protected boolean popupEnabled
protected java.awt.FontMetrics fontMetrics
protected int fontWidth
protected int fontHeight
public ModalKeymap.ModeStateInfo keymapStateInfo
ModalKeymap
protected javax.swing.Action lastAction
protected java.lang.ref.WeakReference editorRef
public static final int CENTER_ALWAYS
public static final int CENTER_IF_NEAR_EDGE
public static final int CENTER_IF_OFFSCREEN
public static final int CENTER_NEVER
public static final int ONSCREEN
public static final int ONETHIRD_ALWAYS
public static final int ONETHIRD_IF_NEAR_EDGE
public static final int ONETHIRD_IF_OFFSCREEN
public static final int TWOTHIRD_ALWAYS
public static final int TWOTHIRD_IF_NEAR_EDGE
public static final int TWOTHIRD_IF_OFFSCREEN
public static final int NOT_OUT_OF_BOUNDS
gotoOffset
public static int LINE_PADDING
Constructor Detail |
public EditorPane()
Method Detail |
public void setLastAction(javax.swing.Action action)
action
- the last action executed.public javax.swing.Action getLastAction()
public void release()
public void updateUI()
updateUI
in class javax.swing.text.JTextComponent
JComponent.updateUI()
public void updateColors()
public void updateColors(javax.swing.text.StyleContext context)
context
- the new style context used for colors.public void setCaret(javax.swing.text.Caret c)
setCaret
in class javax.swing.text.JTextComponent
c
- the new Caret to set.public void setFont(java.awt.Font f)
setFont
in class javax.swing.JComponent
f
- The font to become this component's font.Component.getFont()
public int getFontHeight()
public int getFontWidth()
public java.awt.FontMetrics getFontMetrics()
public ModalKeymap.ModeStateInfo getKeymapStateInfo()
ModalKeymap#ModeStateInfo
public boolean isPopupEnabled()
public void setPopupEnabled(boolean enabled)
It is also very important that any system which uses this flag resets it to the correct value when the system is finished, so that other systems can come up.
enabled
- Set to false if nobody else should bring up a
popup window, otherwise set to true.public void startUndoGroup()
endUndoGroup()
public void endUndoGroup()
startUndoGroup()
public void startUndoSegment(int type)
type
- The type of modification this undoSegment will contain. Valid
types are:endUndoSegment()
public void endUndoSegment()
startUndoSegment(int)
public boolean canUndo()
undo()
,
JBUndoManager
public boolean canRedo()
undo()
,
JBUndoManager
public void undo()
This method checks the caret positioning after the appropriate edit in the UndoManager. If the caret is not currently in that position, it is moved to that position. If it is already in that position, then the appropriate edit is undone.
redo()
,
JBUndoManager
public void undo(boolean checkPosition)
checkPosition
- If true, this method checks the caret positioning
after the appropriate edit in the UndoManager. if the caret is not
currently in that position, it is moved to that position. if it is
already in that position, then the appropriate edit is undone.redo()
,
JBUndoManager
public void redo()
This method checks the caret positioning before the appropriate edit in the UndoManager. if the caret is not currently in that position, it is moved to that position. if it is already in that position, then the appropriate edit is redone.
undo()
,
JBUndoManager
public void redo(boolean checkPosition)
checkPosition
- if true, this method checks the caret positioning
after the appropriate edit in the UndoManager. if the caret is not
currently in that position, it is moved to that position. if it is
already in that position, then the appropriate edit is redone.redo()
,
JBUndoManager
protected void positionCaret(int point, int mark)
point
- The offset at which to position the caret dot. if this value
is -1
, the caret is not moved.mark
- The offset at which to position the caret mark. if this value
is -1
, no mark is placed.public void insertChar(java.lang.String content) throws javax.swing.text.BadLocationException
content
- A string consisting of the new content to insert. Null or
an empty string here removes the character after the caret.public void deleteNextChar() throws javax.swing.text.BadLocationException
public void deletePrevChar() throws javax.swing.text.BadLocationException
public void overwriteChar(java.lang.String content) throws javax.swing.text.BadLocationException
content
- A string consisting of the new content to insert. Null or
an empty string here removes the character after the caret.public void replaceSelection(java.lang.String content)
This method should only be used when doing a non-trivial change, or when being called from within an undo group. This is because this method creates an undo group so that the removal of the current selection, and the insertion of the new text are treated as a unit. Since an undo group is used, these operations cannot be coalesced.
if a "primitive" operation is being performed, use deleteNextChar, deletePrevChar, overwriteChar, or insertChar.
replaceSelection
in class javax.swing.JEditorPane
content
- A string consisting of the new content to insert. Null or
an empty string here simply deletes the existing selection.deleteNextChar()
,
#deletePreChar
,
overwriteChar(java.lang.String)
,
insertChar(java.lang.String)
public void paste()
The one additional thing this method does is ensures that the pasted text uses linefeed characters as line separators.
paste
in class javax.swing.text.JTextComponent
replaceSelection(java.lang.String)
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JEditorPane
Component.getPreferredSize()
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in class javax.swing.text.JTextComponent
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater than zero for down/right.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in class javax.swing.text.JTextComponent
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater than zero for down/right.Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int)
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in class javax.swing.JEditorPane
Scrollable.getScrollableTracksViewportWidth()
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
e
- the event that triggered this call.public void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
e
- the event that triggered this callpublic void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- the event describing the property that changed.public void setTemporaryMark(int lineNumber, LineMark mark)
There can only be one temporary mark per editor, so this method has the side effect of removing the previous temporary mark. This function also guarantees that the temporary mark is only visible in this editor instance by calling LineMark.setEditorReference(this), and when this linemark is removed later on, LineMark.setEditorReference(null) will be called to disassociate the linemark from the editor.
lineNumber
- the 1-based line number where the temporary mark should
be placed.mark
- The LineMark to use as the temporary mark.public void setHighlight(int lineNumber)
lineNumber
- the 1-based line number that should be highlighted.public void clearHighlight()
public void clearTemporaryMark()
public void repaintLine(int lineNumber)
lineNumber
- the line number to repaint.public int getLineCount()
public void gotoOffset(int p0, boolean highlight, int centerPolicy)
NOTE: The gotoOffset(...) methods are generally used when driving the editor from an outside source. if you simply wish to position the caret within an EditorAction, you should probably use setCaretPosition().
p0
- The offset to go to.highlight
- True if the editor should highlight the line.center
- True if the editor should center on the line containing the
offset. if false, the editor will simply ensure that the
line is within the viewport.public void gotoOffset(int p0, boolean highlight, int centerPolicy, int topHiddenLine, int bottomHiddenLine)
p0
- The offset to go to.highlight
- True if the editor should highlight the line.centerPolicy
- True if the editor should center on the line containing the
offset. if false, the editor will simply ensure that the
line is within the viewport.topHiddenLine
- The top line of the area that should be avoided.bottomHiddenLine
- The bottom line of the area that should be avoided.public void gotoOffset(int p0, boolean highlight)
NOTE: The gotoOffset(...) methods are generally used when driving the editor from an outside source. if you simply wish to position the caret within an EditorAction, you should probably use setCaretPosition().
p0
- The offset to go to.highlight
- True if the editor should highlight the line.public void gotoOffset(int p0)
NOTE: The gotoOffset(...) methods are generally used when driving the editor from an outside source. if you simply wish to position the caret within an EditorAction, you should probably use setCaretPosition().
p0
- The offset to go to.public void gotoLine(int lineNumber, boolean highlight, int centerPolicy)
lineNumber
- the 1-based line number to go tohighlight
- True if the editor should highlight the line.center
- True if the editor should center on the line in question. If
false, the editor will simply ensure that the line is within
the viewport.public void gotoLine(int lineNumber, boolean highlight)
lineNumber
- the line number to go tohighlight
- True if the editor should highlight the line.public void gotoLine(int lineNumber)
lineNumber
- the line number to go topublic void gotoPosition(int line, int column, boolean highlight, int centerPolicy)
line
- The 1-based line number to go to.column
- The 1-based column number to go to.highlight
- True if the editor should highlight the line.center
- True if the editor should center on the line containing the
position in question. if false, the editor will simply
ensure that the line is within the viewport.public void gotoPosition(int line, int column, boolean highlight)
line
- The 1-based line number to go to.column
- The 1-based column number to go to.highlight
- True if the editor should highlight the line.public void gotoPosition(int line, int column)
line
- The 1-based line number to go to.column
- The 1-based column number to go to.public int getLineNumber(int p0)
p0
- the position for which to return the line number.public int getColumnNumber(int p0)
p0
- the position for which to return the column number.public java.lang.String getTextLine(int lineNumber)
lineNumber
- the 1-based linenumber for which to retrieve the text.public void insertAt(int p0, java.lang.String text)
p0
- The position in which to insert the text.text
- The text to insert at position p0.public void insertAt(int lineNumber, int column, java.lang.String text)
line
- The line number on which to insert the text. This parameter
is 1-based.column
- The column number on which to insert the text. This parameter
is 1-based.text
- The text to insert.public void setCaretPosition(int lineNumber, int column)
line
- The line number on which to position the caret. This parameter
is 1-based.column
- The column number on which to position the caret. This parameter
is 1-based.public int calcCaretPosition(int lineNumber, int column)
line
- The line number for which to calculate the position. This
parameter is 1-based. if this is out of the document's range,
it is treated as either the first or last line of the document.column
- The column number for which to calculate the position. This
parameter is 1-based. if this is out of the line's range, it
is treated as the first column of the line.public void selectCharacters(int numChars)
numChars
- the number of characters to select from the current caret
offset.public int getTopLine()
public void setTopLine(int lineNumber)
lineNumber
- the 1-based lineNumber to make the first visible line.public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
getToolTipText
in class javax.swing.JComponent
public static void registerToolTipProvider(ToolTipProvider provider)
public java.lang.ref.WeakReference getReference()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |