|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | 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 oracle.javatools.editor.BasicEditorPane
A BasicEditorPane
is an extension of the
JEditorPane
to provide more flexible syntax and
background highlighting functionality at a reduced memory and
performance footprint. It can be used anywhere a
JEditorPane
instance can be used. Clients are
strongly encouraged to call dispose()
when the
the editor pane is no longer needed, but this is not an absolute
requirement. This allows us to clean up as well as notify
editor plugins that the editor is no longer being used.
Undo Support:
The editor framework provides some support for naming edits,
grouping together similar edits, and undo of navigation. When
making a change to the document using insertString()
or remove()
, or through the editor using
replaceSelection()
, cut()
, or
paste()
, you can specify a name for the edit by
creating an EditDescriptor
for the edit, and
passing it to BasicEditorPane.beginEdit(EditDescriptor)
.
Additionally, you can use it for grouping together a group of
edits as a single undoable unit by placing your edits between
a call to BasicEditorPane.beginEdit(EditDescriptor)
and
BasicEditorPane.endEdit(EditDescriptor)
.
The edit name which you specify through the EditDescriptor
is made available through the UndoableEdit
using
getPresentationName()
. This allows you to name your
edits like "Add Button", or "Add Field" so that it better describes
the edit operation the Undo or Redo applies to.
Built-in actions have pre-defined names used for the
EditDescriptor
already. Additionally, the editor
provides automatic support for merging simple edits. Currently,
the simple edit consists of a key-typed insert (insert mode),
a key-typed replace (overwrite mode), delete next (Delete key), or
delete previous (Backspace key). These simple edits may be
merged with other consecutive simple edits of the same type. That
means two inserts in a row will be automatically merged if merging
for key-typed inserts is enabled, and the merge count allowed
is set to greater than two. Look in EditorProperties
for the properties to set to enable merging of simple edits, and
for setting the merge count.
The editor also provides support for undoing navigation (without
associated document changes) using beginNavigation()
and endNavigation()
. Client code which causes
a navigation in the editor (such as "Go to Line", or "Find")
should always wrap their navigation commands with calls to
beginNavigation()
and endNavigation
.
The current default for the editor is to generate undo events
for navigation, though this can be disabled with the appropriate
property in EditorProperties
. If the editor is
set to not generate undos for navigation, the
beginNavigation()
and endNavigation()
will
just be NOP calls.
As with the Swing text framework, the UndoableEditListener should
be attached to the document (BasicDocument
). Undo
edits (including navigation) will be delivered through the
document.
Highlight Support:
For highlight support, refer to the documentation for the
HighlightLayer
class.
Underline Support:
For underline support, refer to the documentation for the
UnderlineLayer
class.
Tooltip Support:
For tooltip support, refer to the documentation for the
TooltipProvider
interface.
Popup Support:
For popup (context) menu support, refer to the documentation
for the PopupManager
interface.
Nested Class Summary |
Nested classes inherited from class javax.swing.JEditorPane |
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport |
Nested classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
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 | |
BasicEditorPane()
Creates a new instance of a BasicEditorPane. |
Method Summary | |
void |
addActionHookInvoker(ActionHookInvoker invoker)
Adds an ActionHookInvoker to the list so that it has a chance to override the default action temporarily. |
void |
addActionPostInvoker(ActionPostInvoker invoker)
Adds an ActionPostInvoker to the list so that it gets notified of successfully completed actions just after the fact. |
void |
addCharacterTypedListener(CharacterTypedListener listener)
Adds a character typed listener to the list so that it can receive notifications of characters typed into this editor pane. |
void |
addFeedbackManager(FeedbackManager manager)
Installs the given FeedbackManager for displaying
feedback messages to the user for this editor pane. |
void |
addPopupManager(PopupManager manager)
Installs the given PopupManager for managing popup menus
for this editor pane. |
void |
addToolTipProvider(ToolTipProvider provider)
Installs the given ToolTipProvider for providing
tooltips for the editor pane. |
void |
autoscroll(java.awt.Point location)
Notify the Component to autoscroll. |
void |
beginEdit(EditDescriptor editDescriptor)
Marks the start of an Undoable edit applied through this editor. |
void |
beginNavigation()
Marks the start of a navigation through this editor. |
boolean |
canCopy()
Fetches whether a copy operation can be performed by calling copy(). |
boolean |
canCut()
Fetches whether a cut operation can be performed by calling cut(). |
boolean |
canPaste()
Fetches whether the paste operation can be performed by calling paste(). |
void |
copy()
Transfers the currently selected range in the associated text model to the system clipboard, leaving the contents in the text model. |
protected javax.swing.text.EditorKit |
createDefaultEditorKit()
Creates the default editor kit for when the component is first created. |
HighlightLayer |
createHighlightLayer()
Creates a new highlight layer that can be used for highlighting text in this editor pane. |
UnderlineLayer |
createUnderlineLayer()
Creates a new underline layer that can be used for underlining text in this editor pane. |
void |
cut()
Transfers the currently selected range in the associated text model to the system clipboard, removing the contents from the model. |
protected void |
deinstallAllPlugins()
Utility routine to deinstall all plugins. |
protected void |
deinstallKeyboardSupport()
Support routine to deinitialize the keyboard support for this editor pane instance. |
void |
deinstallPlugin(EditorPlugin plugin)
This deinstalls an editor plugin from the editor. |
void |
destroyHighlightLayer(HighlightLayer layer)
Destroys a highlight layer that is no longer needed. |
void |
destroyUnderlineLayer(UnderlineLayer layer)
Destroys a underline layer that is no longer needed. |
void |
dispose()
Instructs this editor pane that it is no longer needed, and that it can clear up resources and references. |
void |
endEdit()
Marks the end of an Undoable edit applied through this editor. |
void |
endNavigation()
Marks the end of a navigation through this editor. |
protected void |
ensureVisibleAndCentered(int location)
|
protected void |
ensureVisibleAndCentered(java.awt.Rectangle positionRect)
Utility routine to ensure that the given position is visible vertically and horizontally. |
protected void |
ensureVisibleAndCentered(java.awt.Rectangle positionRect,
boolean force)
Utility routine to ensure that the given position is visible vertically and horizontally. |
protected void |
finalize()
Finalizer to clean up the editor in case it was not disposed of properly. |
protected void |
fireCharacterTypedEvent(int offset,
char charTyped)
Utility routine used to notify listeners that a character was typed. |
ActionInvoker |
getActionInvoker()
Fetches the action invoker to use to execute some particular action. |
java.awt.Insets |
getAutoscrollInsets()
This method returns the Insets describing the
autoscrolling region or border relative to the geometry of the
implementing Component. |
boolean |
getBooleanProperty(java.lang.String key)
Fetch the boolean property stored by the given key. |
FeedbackManager |
getFeedbackManager()
Fetches the current installed FeedbackManager . |
FontHelper |
getFontHelper()
Convenience method for getting the current font helper. |
javax.swing.text.Highlighter |
getHighlighter()
Fetches the object responsible for making highlights. |
protected java.util.Iterator |
getHighlightLayers()
Fetches an iterator to access the highlight layers associated with this editor pane. |
HighlightRegistry |
getHighlightRegistry()
Fetch the global highlight registry used for all editor panes. |
int |
getIntegerProperty(java.lang.String key)
Fetch the integer property stored by the given key. |
int |
getLineCount()
Fetches the number of lines in this TextBuffer . |
int |
getLineEndOffset(int line)
Given a specified line, returns the offset from the beginning of a TextBuffer that the line ends at. |
int |
getLineFromOffset(int offset)
Given an offset from the beginning of the underlying TextBuffer , fetches the line number containing that
offset using a Forward bias. |
int |
getLineStartOffset(int line)
Given a specified line, returns the offset from the beginning of the TextBuffer for the start of the line. |
PopupManager |
getPopupManager()
Fetches the current installed PopupManager . |
java.lang.Object |
getProperty(java.lang.String key)
Get the property associated with the given key. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. |
StyleRegistry |
getStyleRegistry()
Fetch the global style registry used for all editor panes. |
ToolTipProvider |
getToolTipProvider()
Fetches the current installed ToolTipProvider . |
java.lang.String |
getToolTipText()
Returns the tooltip string that has been set with setToolTipText(). |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
Returns the string to be used as the tooltip for event. |
protected java.util.Iterator |
getUnderlineLayers()
Fetches an iterator to access the underline layers associated with this editor pane. |
UnderlineRegistry |
getUnderlineRegistry()
Fetch the global underline registry used for all editor panes. |
boolean |
hasSelection()
Fetches whether there is currently a selection in the editor. |
protected void |
installBuiltInPlugins()
Utility routine to install known, built-in plugins. |
protected void |
installKeyboardSupport()
Support routine to initialize the keyboard support for this editor pane instance. |
void |
installPlugin(EditorPlugin plugin)
This installs an editor plugin into the editor. |
void |
invokeAction(java.lang.String actionKey)
Invokes the Action corresponding to the given actionKey. |
protected boolean |
isCutCopyLineEnabled()
Checks whether Cut/Copy on current line with no selection is enabled. |
boolean |
isProtected()
Fetches whether the editor's content is protected or not - this may be used by clients to indicate that the document is some sort of protected content, and that changes cannot be made directly through the editor, but through other wizards or dialogs instead. |
void |
moveCaretPosition(int position)
Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called. |
void |
moveCaretPositionCenter(int position)
Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called. |
void |
paste()
Transfers the contents of the system clipboard into the associated text model. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed. |
void |
putBooleanProperty(java.lang.String key,
boolean value)
Sets the boolean property and value in the property table. |
void |
putIntegerProperty(java.lang.String key,
int value)
Sets the integer property and value in the property table. |
void |
putProperty(java.lang.String key,
java.lang.Object value)
Store the property associated with the given key. |
void |
removeActionHookInvoker(ActionHookInvoker invoker)
Removes an ActionHookInvoker from our list. |
void |
removeActionPostInvoker(ActionPostInvoker invoker)
Removes an ActionPostInvoker from our list. |
void |
removeCharacterTypedListener(CharacterTypedListener listener)
Removes a character typed listener from the list so that it no longer receives notifications. |
void |
removeFeedbackManager(FeedbackManager manager)
Deinstalls the given FeedbackManager that was previously
installed for handling feedback messages for this editor pane. |
void |
removePopupManager(PopupManager manager)
Deinstalls the given PopupManager that was previously
installed for managing popup menus for the editor pane. |
void |
removeToolTipProvider(ToolTipProvider provider)
Deinstalls the given ToolTipProvider that was
previously installed for getting tooltip info for the editor pane. |
void |
replaceSelection(java.lang.String content)
Replaces the currently selected content with the new content represented by the given String. |
void |
select(int selectionStart,
int selectionEnd)
Selects the text found between the specified start and end locations. |
void |
selectAll()
Selects all the text in the TextComponent. |
void |
setBaseFont(java.lang.String fontFamily,
int fontSize)
Set the base font of this editor pane independently from the global base font. |
void |
setCaretPosition(int position)
Sets the position of the text insertion caret for the TextComponent. |
void |
setCaretPositionCenter(int position)
Sets the position of the text insertion caret for the TextComponent. |
void |
setDocument(javax.swing.text.Document doc)
Associates the editor with the text document. |
void |
setEditable(boolean editable)
Sets the specified boolean to indicate whether or not this TextComponent should be editable. |
void |
setFont(java.awt.Font font)
We override the setFont implementation, as the
font handling in the editor framework is different. |
void |
setHighlighter(javax.swing.text.Highlighter h)
Sets the highlighter to be used. |
void |
setHighlightRegistry(HighlightRegistry registry)
Replace the global highlight registry used for all editor panes. |
void |
setLanguageSupport(java.lang.String fileName)
Sets the LanguageSupport for editing the type of content indicated by the specified filename. |
void |
setProtected(boolean makeProtected)
Sets the editor in protected mode or not. |
void |
setStyleRegistry(StyleRegistry registry)
Replace the global style registry used for all editor panes. |
void |
setToolTipText(java.lang.String text)
Registers the text to display in a tool tip. |
void |
setUnderlineRegistry(UnderlineRegistry registry)
Replace the global underline registry used for all editor panes. |
void |
unselect()
Unselects the current text selection (if any), but leaves the caret where it is. |
void |
updateUI()
Reloads the pluggable UI. |
protected boolean |
useDefaultKeyHandling()
Fetches whether the default use of the multi-key handler should be used. |
protected void |
validateVisibleRect(java.awt.Rectangle visibleRect)
Utility method to ensure that the visible rectangle does not go beyond the edges of the editor view. |
Methods inherited from class javax.swing.JEditorPane |
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, getUIClassID, paramString, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage, setText |
Methods inherited from class javax.swing.text.JTextComponent |
addCaretListener, addInputMethodListener, addKeymap, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getUI, isEditable, loadKeymap, modelToView, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, setCaret, setCaretColor, setComponentOrientation, setDisabledTextColor, setDragEnabled, setFocusAccelerator, setKeymap, setMargin, setNavigationFilter, 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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BasicEditorPane()
dispose()
Method Detail |
public void setLanguageSupport(java.lang.String fileName)
fileName
- the name of the filepublic void beginEdit(EditDescriptor editDescriptor)
editDescriptor
- the edit descriptor describes this edit, such
as providing a human-readable namepublic void endEdit()
public void beginNavigation()
public void endNavigation()
public void unselect()
public void setCaretPositionCenter(int position)
setCaretPosition()
except that if the new caret
position is offscreen, it recenters the new position vertically
into the center of the parent view port.
position
- the positionpublic void moveCaretPositionCenter(int position)
setCaretPositionCenter
in that if the new position
is offscreen, it recenters the new position vertically into the
center of the parent view port.
position
- the positionprotected void finalize() throws java.lang.Throwable
java.lang.Throwable
public void dispose()
public boolean isProtected()
public void setProtected(boolean makeProtected)
makeProtected
- true to set the editor in protected modeprotected boolean isCutCopyLineEnabled()
public boolean canCut()
public boolean canCopy()
public boolean canPaste()
public boolean hasSelection()
public FontHelper getFontHelper()
public void setBaseFont(java.lang.String fontFamily, int fontSize)
fontFamily
- the font family of the base fontfontSize
- the font size of the base fontpublic StyleRegistry getStyleRegistry()
public void setStyleRegistry(StyleRegistry registry)
registry
- the new registry to usepublic HighlightRegistry getHighlightRegistry()
public void setHighlightRegistry(HighlightRegistry registry)
registry
- the new registry to usepublic UnderlineRegistry getUnderlineRegistry()
public void setUnderlineRegistry(UnderlineRegistry registry)
registry
- the new registry to usepublic void setFont(java.awt.Font font)
setFont
implementation, as the
font handling in the editor framework is different. Since this
editor is capable of rendering different styles for the same
font, and since we are using global fonts from our properties, we
ignore the normal Swing/AWT set font mechanism. To change the
base font of this editor by itself, use
BasicEditorPane.setBaseFont()
. To change the global
base font of the editor framework, use
EditorProperties.setBaseFont()
.
font
- the font to setpublic void setEditable(boolean editable)
editable
- the boolean to be setprotected javax.swing.text.EditorKit createDefaultEditorKit()
public void updateUI()
public void setDocument(javax.swing.text.Document doc)
doc
- the new documentpublic void cut()
public void copy()
public void paste()
replaceSelection(java.lang.String)
public void replaceSelection(java.lang.String content)
content
- the new content to replace the current selectionpublic void selectAll()
public void select(int selectionStart, int selectionEnd)
selectionStart
- the start position of the text >= 0selectionEnd
- the end position of the text >= 0setCaretPosition(int)
,
moveCaretPosition(int)
public javax.swing.text.Highlighter getHighlighter()
public void setHighlighter(javax.swing.text.Highlighter h)
h
- the highlighterpublic void setToolTipText(java.lang.String text)
text
- the text to display in a tool tip.public java.lang.String getToolTipText()
public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface javax.swing.Scrollable
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.
JScrollBar.setUnitIncrement(int)
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface javax.swing.Scrollable
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.
JScrollBar.setBlockIncrement(int)
public void setCaretPosition(int position)
position
- the positionpublic void moveCaretPosition(int position)
position
- public java.awt.Insets getAutoscrollInsets()
Insets
describing the
autoscrolling region or border relative to the geometry of the
implementing Component.
This value is read once by the DropTarget
upon entry
of the drag Cursor
into the associated
Component
.
getAutoscrollInsets
in interface java.awt.dnd.Autoscroll
public void autoscroll(java.awt.Point location)
Component
to autoscroll.
autoscroll
in interface java.awt.dnd.Autoscroll
location
- the Point
location that triggered
this autoscroll.protected void validateVisibleRect(java.awt.Rectangle visibleRect)
visibleRect
- the visible rect to validatepublic final java.lang.Object getProperty(java.lang.String key)
key
- the property to get
EditorProperties
public final void putProperty(java.lang.String key, java.lang.Object value)
key
- the property to storevalue
- the value to storeEditorProperties
public boolean getBooleanProperty(java.lang.String key)
key
- the property to get
java.lang.ClassCastException
- if the property is not a boolean propertypublic void putBooleanProperty(java.lang.String key, boolean value)
key
- the property namevalue
- the property valuepublic int getIntegerProperty(java.lang.String key)
key
- the property to get
java.lang.ClassCastException
- if the property is not a integer propertypublic void putIntegerProperty(java.lang.String key, int value)
key
- the property namevalue
- the property valuepublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- A PropertyChangeEvent object describing the event source
and the property that has changed.public int getLineCount()
TextBuffer
. For
example, a 5-line TextBuffer
has lines 0 through 4.
TextBuffer
public int getLineFromOffset(int offset)
TextBuffer
, fetches the line number containing that
offset using a Forward bias. This means if line A starts with
offset B, and previous line A-1 ends with offset B,
getLineFromOffset(B)
will return line A.
public int getLineStartOffset(int line)
TextBuffer
for the start of the line.
line
- a line in the TextBuffer
public int getLineEndOffset(int line)
TextBuffer
that the line ends at.
line
- a line in the TextBuffer
public void addActionHookInvoker(ActionHookInvoker invoker)
invoker
- the invoker to addpublic void removeActionHookInvoker(ActionHookInvoker invoker)
invoker
- the invoker to removepublic void addActionPostInvoker(ActionPostInvoker invoker)
invoker
- the invoker to addpublic void removeActionPostInvoker(ActionPostInvoker invoker)
invoker
- the invoker to removepublic ActionInvoker getActionInvoker()
public void invokeAction(java.lang.String actionKey)
invokeAction
in interface ActionInvoker
actionKey
- the published key for the actionpublic void installPlugin(EditorPlugin plugin)
install()
method of
the plugin as well as add the plugin as a
PropertyChangeListener
of the editor to receive
property change events.
plugin
- the plugin to installpublic void deinstallPlugin(EditorPlugin plugin)
deinstall()
method of
the plugin as well as remove the plugin from being a
PropertyChangeListener
of the editor.
plugin
- the plugin to deinstallprotected void installBuiltInPlugins()
protected void deinstallAllPlugins()
public HighlightLayer createHighlightLayer()
public void destroyHighlightLayer(HighlightLayer layer)
layer
- the highlight layer to removeprotected java.util.Iterator getHighlightLayers()
public UnderlineLayer createUnderlineLayer()
public void destroyUnderlineLayer(UnderlineLayer layer)
layer
- the underline layer to removeprotected java.util.Iterator getUnderlineLayers()
public void addPopupManager(PopupManager manager)
PopupManager
for managing popup menus
for this editor pane. When the user requests a popup menu, usually
by right-clicking in the editor content, the showPopup()
method of the PopupManager
will be called. Only one
PopupManager
can be installed at any given time (but
this is not enforced programmatically at the current time.)
manager
- the popup manager to installpublic void removePopupManager(PopupManager manager)
PopupManager
that was previously
installed for managing popup menus for the editor pane.
manager
- the popup manager to de-installpublic PopupManager getPopupManager()
PopupManager
. This is
primarily used within the editor component, for example by the
BasicCaret, to notify the appropriate PopupManager
for handling events related to popup menus. This will return
null if there is no popup manager installed.
PopupMenu
public void addToolTipProvider(ToolTipProvider provider)
ToolTipProvider
for providing
tooltips for the editor pane. When the user requests a tooltip
(by moving the mouse over text in the editor and waiting), the
getToolTipText()
method of the
ToolTipProvider
will be called. Only one
ToolTipProvider
can be installed at any given time
(but this is not enforced programmatically currently.)
provider
- the tool tip provider to installpublic void removeToolTipProvider(ToolTipProvider provider)
ToolTipProvider
that was
previously installed for getting tooltip info for the editor pane.
provider
- the tooltip provider to de-install.public ToolTipProvider getToolTipProvider()
ToolTipProvider
. This
is primarily used within the editor component, for example when a
tool tip needs to be popped up. This will return null if there
is no popup manager installed.
ToolTipProvider
public void addFeedbackManager(FeedbackManager manager)
FeedbackManager
for displaying
feedback messages to the user for this editor pane. Only
one FeedbackManager
can be installed at any given
time (this is not enforce programmatically however.)
manager
- the feedback manager to installpublic void removeFeedbackManager(FeedbackManager manager)
FeedbackManager
that was previously
installed for handling feedback messages for this editor pane.
manager
- the feedback manager to de-installpublic FeedbackManager getFeedbackManager()
FeedbackManager
. This
is can be used for displaying feedback messages to the user
associated with this editor pane. This will return null if there
is no feedback manager installed.
FeedbackMenu
public void addCharacterTypedListener(CharacterTypedListener listener)
listener
- the listener to addpublic void removeCharacterTypedListener(CharacterTypedListener listener)
listener
- the listener to removeprotected void fireCharacterTypedEvent(int offset, char charTyped)
offset
- the offset where the character was typedcharTyped
- the character that was typedprotected boolean useDefaultKeyHandling()
protected void installKeyboardSupport()
protected void deinstallKeyboardSupport()
protected void ensureVisibleAndCentered(int location)
protected void ensureVisibleAndCentered(java.awt.Rectangle positionRect)
positionRect
- the rectangle to make sure if visibleprotected void ensureVisibleAndCentered(java.awt.Rectangle positionRect, boolean force)
positionRect
- the rectangle to make sure if visibleforce
- whether to force centering
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.