javax.swing.text
Class JTextComponent

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.text.JTextComponent
All Implemented Interfaces:
Accessible, java.awt.image.ImageObserver, MenuContainer, Scrollable, Serializable
Direct Known Subclasses:
JEditorPane, JTextArea, JTextField

public abstract class JTextComponent
extends JComponent
implements Scrollable, Accessible

Safe: JTextComponent is the base class for swing text components. It tries to be compatible with the java.awt.TextComponent class where it can reasonably do so. Also provided are other services for additional flexibility (beyond the pluggable UI and bean support). You can find information on how to use the functionality this class provides in General Rules for Using Text Components, a section in The Java Tutorial.

Caret Changes
The caret is a pluggable object in swing text components. Notification of changes to the caret position and the selection are sent to implementations of the CaretListener interface that have been registered with the text component. The UI will install a default caret unless a customized caret has been set.

Commands
Text components provide a number of commands that can be used to manipulate the component. This is essentially the way that the component expresses its capabilities. These are expressed in terms of the swing Action interface, using the TextAction implementation. The set of commands supported by the text component can be found with the getActions() method. These actions can be bound to key events, fired from buttons, etc.

Text Input
The text components support flexible and internationalized text input, using keymaps and the input method framework, while maintaining compatibility with the AWT listener model.

A javax.swing.text.Keymap lets an application bind key strokes to actions. In order to allow keymaps to be shared across multiple text components, they can use actions that extend TextAction. TextAction can determine which JTextComponent most recently has or had focus and therefore is the subject of the action (In the case that the ActionEvent sent to the action doesn't contain the target text component as its source).

The input method framework lets text components interact with input methods, separate software components that preprocess events to let users enter thousands of different characters using keyboards with far fewer keys. JTextComponent is an active client of the framework, so it implements the preferred user interface for interacting with input methods. As a consequence, some key events do not reach the text component because they are handled by an input method, and some text input reaches the text component as committed text within an java.awt.event.InputMethodEvent instead of as a key event. The complete text input is the combination of the characters in keyTyped key events and committed text in input method events.

The AWT listener model lets applications attach event listeners to components in order to bind events to actions. Swing encourages the use of keymaps instead of listeners, but maintains compatibility with listeners by giving the listeners a chance to steal an event by consuming it.

Keyboard event and input method events are handled in the following stages, with each stage capable of consuming the event:
StageKeyEvent InputMethodEvent
1. input methods (generated here)
2. focus manager
3. registered key listenersregistered input method listeners
4. input method handling in JTextComponent
5. keymap handling using the current keymap
6. keyboard handling in JComponent (e.g. accelerators, component navigation, etc.)

To maintain compatibility with applications that listen to key events but are not aware of input method events, the input method handling in stage 4 provides a compatibility mode for components that do not process input method events. For these components, the committed text is converted to keyTyped key events and processed in the key event pipeline starting at stage 3 instead of in the input method event pipeline.

By default the component will create a keymap (named DEFAULT_KEYMAP) that is shared by all JTextComponent instances as the default keymap. Typically a look-and-feel implementation will install a different keymap that resolves to the default keymap for those bindings not found in the different keymap. The minimal bindings include:

Model/View Split
The text components have a model-view split. A text component pulls together the objects used to represent the model, view, and controller. The text document model may be shared by other views which act as observers of the model (e.g. a document may be shared by multiple components).

The model is defined by the Document interface. This is intended to provide a flexible text storage mechanism that tracks change during edits and can be extended to more sophisticated models. The model interfaces are meant to capture the capabilities of expression given by SGML, a system used to express a wide variety of content. Each modification to the document causes notification of the details of the change to be sent to all observers in the form of a DocumentEvent which allows the views to stay up to date with the model. This event is sent to observers that have implemented the DocumentListener interface and registered interest with the model being observed.

Location Information
The capability of determining the location of text in the view is provided. There are two methods, modelToView(int) and viewToModel(java.awt.Point) for determining this information.

Undo/Redo support
Support for an edit history mechanism is provided to allow undo/redo operations. The text component does not itself provide the history buffer by default, but does provide the UndoableEdit records that can be used in conjunction with a history buffer to provide the undo/redo support. The support is provided by the Document model, which allows one to attach UndoableEditListener implementations.

Thread Safety
The swing text components provide some support of thread safe operations. Because of the high level of configurability of the text components, it is possible to circumvent the protection provided. The protection primarily comes from the model, so the documentation of AbstractDocument describes the assumptions of the protection provided. The methods that are safe to call asynchronously are marked with comments.

Newlines
For a discussion on how newlines are handled, see DefaultEditorKit.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder.

Version:
1.196 05/15/02
Author:
Timothy Prinzing
See Also:
Document, DocumentEvent, DocumentListener, Caret, CaretEvent, CaretListener, TextUI, View, ViewFactory, Serialized Form

Field Summary
private  Caret caret
          The caret used to display the insert position and navigate throughout the document.
private  Color caretColor
           
private  javax.swing.text.JTextComponent.MutableCaretEvent caretEvent
           
private  boolean checkedInputOverride
          Set to true after the check for the override of processInputMethodEvent has been checked.
private  java.text.AttributedString composedText
           
private  javax.swing.text.JTextComponent.ComposedTextCaret composedTextCaret
           
private  String composedTextContent
           
private  Position composedTextEnd
           
private  Position composedTextStart
           
static String DEFAULT_KEYMAP
          Suppressed: The default keymap that will be shared by all JTextComponent instances unless they have had a different keymap set.
private static javax.swing.text.JTextComponent.DefaultTransferHandler defaultTransferHandler
          TransferHandler used if one hasn't been supplied by the UI.
private  Color disabledTextColor
           
private  boolean dragEnabled
           
private  boolean editable
           
private  JTextComponent editor
           
static String FOCUS_ACCELERATOR_KEY
          Suppressed: The bound property name for the focus accelerator.
private  char focusAccelerator
           
private static JTextComponent focusedComponent
          The most recent JTextComponent that has/had focus.
private  Highlighter highlighter
          The object responsible for managing highlights.
private  java.awt.im.InputMethodRequests inputMethodRequestsHandler
           
private  Keymap keymap
          The current key bindings in effect.
private static Hashtable keymapTable
           
private  Position latestCommittedTextEnd
           
private  Position latestCommittedTextStart
           
private  Insets margin
           
private  Document model
          The document model.
private  NavigationFilter navigationFilter
          Object responsible for restricting the cursor navigation.
private  boolean needToSendKeyTypedEvent
           
private  Caret originalCaret
           
private static Map overrideMap
          Maps from class name to Boolean indicating if processInputMethodEvent has been overriden.
private  Color selectedTextColor
           
private  Color selectionColor
           
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
JTextComponent()
          Enabled: Creates a new JTextComponent.
 
Method Summary
 void addCaretListener(CaretListener listener)
          Enabled: Adds a caret listener for notification of any changes to the caret.
 void addInputMethodListener(InputMethodListener l)
          Suppressed:
static Keymap addKeymap()
          Added: Safe replacement for the suppressed static addKeymap/2.
static Keymap addKeymap(String nm, Keymap parent)
          Suppressed: Adds a new keymap into the keymap hierarchy.
 void copy()
          Suppressed: Transfers the currently selected range in the associated text model to the system clipboard, leaving the contents in the text model.
private  void createComposedString(int composedIndex, java.text.AttributedCharacterIterator text)
           
 void cut()
          Suppressed: Transfers the currently selected range in the associated text model to the system clipboard, removing the contents from the model.
private  void exchangeCaret(Caret oldCaret, Caret newCaret)
           
protected  void fireCaretUpdate(CaretEvent e)
          Notifies all listeners that have registered interest for notification on this event type.
 AccessibleContext getAccessibleContext()
          Suppressed: Gets the AccessibleContext associated with this JTextComponent.
 Action[] getActions()
          Suppressed: Fetches the command list for the editor.
 Caret getCaret()
          Enabled: Fetches the caret that allows text-oriented navigation over the view.
 Color getCaretColor()
          Enabled: Fetches the current color used to render the caret.
 CaretListener[] getCaretListeners()
          Suppressed: Returns an array of all the caret listeners registered on this text component.
 int getCaretPosition()
          Enabled: Returns the position of the text insertion caret for the text component.
private  int getCurrentEventModifiers()
           
 Color getDisabledTextColor()
          Enabled: Fetches the current color used to render the selected text.
 Document getDocument()
          Enabled: Fetches the model associated with the editor.
 boolean getDragEnabled()
          Enabled: Gets the dragEnabled property.
 char getFocusAccelerator()
          Enabled: Returns the key accelerator that will cause the receiving text component to get the focus.
(package private) static JTextComponent getFocusedComponent()
          Returns the JTextComponent that most recently had focus.
 Highlighter getHighlighter()
          Enabled: Fetches the object responsible for making highlights.
 java.awt.im.InputMethodRequests getInputMethodRequests()
          Suppressed:
 Keymap getKeymap()
          Suppressed: Fetches the keymap currently active in this text component.
static Keymap getKeymap(String nm)
          Suppressed: Fetches a named keymap previously added to the document.
 Insets getMargin()
          Enabled: Returns the margin between the text component's border and its text.
 NavigationFilter getNavigationFilter()
          Enabled: Returns the NavigationFilter.
 Dimension getPreferredScrollableViewportSize()
          Enabled: Returns the preferred size of the viewport for a view component.
 int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
          Enabled: 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.
 boolean getScrollableTracksViewportHeight()
          Enabled: Returns true if a viewport should always force the height of this Scrollable to match the height of the viewport.
 boolean getScrollableTracksViewportWidth()
          Enabled: Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport.
 int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
          Enabled: 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.
 String getSelectedText()
          Enabled: Returns the selected text contained in this TextComponent.
 Color getSelectedTextColor()
          Enabled: Fetches the current color used to render the selected text.
 Color getSelectionColor()
          Enabled: Fetches the current color used to render the selection.
 int getSelectionEnd()
          Enabled: Returns the selected text's end position.
 int getSelectionStart()
          Enabled: Returns the selected text's start position.
 String getText()
          Enabled: Returns the text contained in this TextComponent.
 String getText(int offs, int len)
          Enabled: Fetches a portion of the text represented by the component.
 String getToolTipText(MouseEvent event)
          Enabled: Returns the string to be used as the tooltip for event.
 javax.swing.plaf.TextUI getUI()
          Suppressed: Fetches the user-interface factory for this text-oriented editor.
private  void installDefaultTransferHandlerIfNecessary()
          If the current TransferHandler is null, this will install a new one.
private  void invokeAction(String name, Action altAction)
          This is a conveniance method that is only useful for cut, copy and paste.
 boolean isEditable()
          Enabled: Returns the boolean indicating whether this TextComponent is editable or not.
private  boolean isProcessInputMethodEventOverridden()
           
private static Boolean isProcessInputMethodEventOverridden(Class klass)
          Returns true if klass is NOT a JTextComponent and it or one of its superclasses (stoping at JTextComponent) overrides processInputMethodEvent.
static void loadKeymap(Keymap map, javax.swing.text.JTextComponent.KeyBinding[] bindings, Action[] actions)
          Suppressed:
private  void mapCommittedTextToAction(String committedText)
           
 Rectangle modelToView(int pos)
          Enabled: Converts the given location in the model to a place in the view coordinate system.
 void moveCaretPosition(int pos)
          Enabled: Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called.
protected  String paramString()
          Returns a string representation of this JTextComponent.
 void paste()
          Suppressed: Transfers the contents of the system clipboard into the associated text model.
protected  void processInputMethodEvent(InputMethodEvent e)
          Processes input method events occurring on this component by dispatching them to any registered InputMethodListener objects.
 void read(Reader in, Object desc)
          Enabled: Initializes from a stream.
private  void readObject(ObjectInputStream s)
          We use the ObjectInputStream "registerValidation" callback to update the UI for the entire tree of components after they've all been read in.
 void removeCaretListener(CaretListener listener)
          Enabled: Removes a caret listener.
static Keymap removeKeymap(String nm)
          Enabled: Removes a named keymap previously added to the document.
 void removeNotify()
          Suppressed:
private  void replaceInputMethodText(InputMethodEvent e)
           
 void replaceSelection(String content)
          Enabled: Replaces the currently selected content with new content represented by the given string.
 void select(int selectionStart, int selectionEnd)
          Enabled: Selects the text between the specified start and end positions.
 void selectAll()
          Enabled: Selects all the text in the TextComponent.
 void setCaret(Caret c)
          Enabled: Sets the caret to be used.
 void setCaretColor(Color c)
          Enabled: Sets the current color used to render the caret.
 void setCaretPosition(int position)
          Enabled: Sets the position of the text insertion caret for the TextComponent.
 void setComponentOrientation(ComponentOrientation o)
          Suppressed:
 void setDisabledTextColor(Color c)
          Enabled: Sets the current color used to render the disabled text.
 void setDocument(Document doc)
          Enabled: Associates the editor with a text document.
 void setDragEnabled(boolean b)
          Enabled: Sets the dragEnabled property, which must be true to enable automatic drag handling (the first part of drag and drop) on this component.
 void setEditable(boolean b)
          Enabled: Sets the specified boolean to indicate whether or not this TextComponent should be editable.
 void setFocusAccelerator(char aKey)
          Enabled: Sets the key accelerator that will cause the receiving text component to get the focus.
 void setHighlighter(Highlighter h)
          Enabled: Sets the highlighter to be used.
private  void setInputMethodCaretPosition(InputMethodEvent e)
           
 void setKeymap(Keymap map)
          Enabled: Sets the keymap to use for binding events to actions.
 void setMargin(Insets m)
          Enabled: Sets margin space between the text component's border and its text.
 void setNavigationFilter(NavigationFilter filter)
          Enabled: Sets the NavigationFilter.
 void setSelectedTextColor(Color c)
          Enabled: Sets the current color used to render the selected text.
 void setSelectionColor(Color c)
          Enabled: Sets the current color used to render the selection.
 void setSelectionEnd(int selectionEnd)
          Enabled: Sets the selection end to the specified position.
 void setSelectionStart(int selectionStart)
          Enabled: Sets the selection start to the specified position.
 void setText(String t)
          Enabled: Sets the text of this TextComponent to the specified text.
 void setUI(javax.swing.plaf.TextUI ui)
          Suppressed: Sets the user-interface factory for this text-oriented editor.
private  boolean shouldSynthensizeKeyEvents()
          Returns true if KeyEvents should be synthesized from an InputEvent.
(package private)  void updateInputMap(Keymap oldKm, Keymap newKm)
          Updates the InputMaps in response to a Keymap change.
 void updateUI()
          Suppressed: Reloads the pluggable UI.
 int viewToModel(Point pt)
          Enabled: Converts the given place in the view coordinate system to the nearest representative location in the model.
 void write(Writer out)
          Enabled: Stores the contents of the model into the given stream.
 
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, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, 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, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, get, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, iterate, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, size, 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, toString, transferFocus, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FOCUS_ACCELERATOR_KEY

public static final String FOCUS_ACCELERATOR_KEY
Suppressed: The bound property name for the focus accelerator.


model

private Document model
The document model.


caret

private transient Caret caret
The caret used to display the insert position and navigate throughout the document. PENDING(prinz) This should be serializable, default installed by UI.


navigationFilter

private NavigationFilter navigationFilter
Object responsible for restricting the cursor navigation.


highlighter

private transient Highlighter highlighter
The object responsible for managing highlights. PENDING(prinz) This should be serializable, default installed by UI.


keymap

private transient Keymap keymap
The current key bindings in effect. PENDING(prinz) This should be serializable, default installed by UI.


caretEvent

private transient javax.swing.text.JTextComponent.MutableCaretEvent caretEvent

caretColor

private Color caretColor

selectionColor

private Color selectionColor

selectedTextColor

private Color selectedTextColor

disabledTextColor

private Color disabledTextColor

editable

private boolean editable

margin

private Insets margin

focusAccelerator

private char focusAccelerator

dragEnabled

private boolean dragEnabled

defaultTransferHandler

private static javax.swing.text.JTextComponent.DefaultTransferHandler defaultTransferHandler
TransferHandler used if one hasn't been supplied by the UI.


overrideMap

private static Map overrideMap
Maps from class name to Boolean indicating if processInputMethodEvent has been overriden.


focusedComponent

private static JTextComponent focusedComponent
The most recent JTextComponent that has/had focus. The text actions use this via the getFocusedComponent method as a fallback case when a JTextComponent doesn't have focus.


keymapTable

private static Hashtable keymapTable

editor

private JTextComponent editor

inputMethodRequestsHandler

private transient java.awt.im.InputMethodRequests inputMethodRequestsHandler

composedText

private java.text.AttributedString composedText

composedTextContent

private String composedTextContent

composedTextStart

private Position composedTextStart

composedTextEnd

private Position composedTextEnd

latestCommittedTextStart

private Position latestCommittedTextStart

latestCommittedTextEnd

private Position latestCommittedTextEnd

composedTextCaret

private javax.swing.text.JTextComponent.ComposedTextCaret composedTextCaret

originalCaret

private transient Caret originalCaret

checkedInputOverride

private boolean checkedInputOverride
Set to true after the check for the override of processInputMethodEvent has been checked.


needToSendKeyTypedEvent

private boolean needToSendKeyTypedEvent

DEFAULT_KEYMAP

public static final String DEFAULT_KEYMAP
Suppressed: The default keymap that will be shared by all JTextComponent instances unless they have had a different keymap set.

Constructor Detail

JTextComponent

public JTextComponent()
Enabled: Creates a new JTextComponent. Listeners for caret events are established, and the pluggable UI installed. The component is marked as editable. No layout manager is used, because layout is managed by the view subsystem of text. The document model is set to null.

Method Detail

getUI

public javax.swing.plaf.TextUI getUI()
Suppressed: Fetches the user-interface factory for this text-oriented editor.

Returns:
the factory

setUI

public void setUI(javax.swing.plaf.TextUI ui)
Suppressed: Sets the user-interface factory for this text-oriented editor.

Parameters:
ui - the factory

updateUI

public void updateUI()
Suppressed: Reloads the pluggable UI. The key used to fetch the new interface is getUIClassID(). The type of the UI is TextUI. invalidate is called after setting the UI.

Overrides:
updateUI in class JComponent
See Also:
JComponent.setUI(javax.swing.plaf.ComponentUI), UIManager.getLookAndFeel(), UIManager.getUI(javax.swing.JComponent)

addCaretListener

public void addCaretListener(CaretListener listener)
Enabled: Adds a caret listener for notification of any changes to the caret.

Parameters:
listener - the listener to be added
See Also:
javax.swing.event.CaretEvent

removeCaretListener

public void removeCaretListener(CaretListener listener)
Enabled: Removes a caret listener.

Parameters:
listener - the listener to be removed
See Also:
javax.swing.event.CaretEvent

getCaretListeners

public CaretListener[] getCaretListeners()
Suppressed: Returns an array of all the caret listeners registered on this text component.

Returns:
all of this component's CaretListeners or an empty array if no caret listeners are currently registered
Since:
1.4
See Also:
addCaretListener(javax.swing.event.CaretListener), removeCaretListener(javax.swing.event.CaretListener)

fireCaretUpdate

protected void fireCaretUpdate(CaretEvent e)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. The listener list is processed in a last-to-first manner.

Parameters:
e - the event
See Also:
EventListenerList

setDocument

public void setDocument(Document doc)
Enabled: Associates the editor with a text document. The currently registered factory is used to build a view for the document, which gets displayed by the editor after revalidation. A PropertyChange event ("document") is propagated to each listener.

Parameters:
doc - the document to display/edit
See Also:
getDocument()

getDocument

public Document getDocument()
Enabled: Fetches the model associated with the editor. This is primarily for the UI to get at the minimal amount of state required to be a text editor. Subclasses will return the actual type of the model which will typically be something that extends Document.

Returns:
the model

setComponentOrientation

public void setComponentOrientation(ComponentOrientation o)
Suppressed:

Overrides:
setComponentOrientation in class Component
See Also:
ComponentOrientation

getActions

public Action[] getActions()
Suppressed: Fetches the command list for the editor. This is the list of commands supported by the plugged-in UI augmented by the collection of commands that the editor itself supports. These are useful for binding to events, such as in a keymap.

Returns:
the command list

setMargin

public void setMargin(Insets m)
Enabled: Sets margin space between the text component's border and its text. The text component's default Border object will use this value to create the proper margin. However, if a non-default border is set on the text component, it is that Border object's responsibility to create the appropriate margin space (else this property will effectively be ignored). This causes a redraw of the component. A PropertyChange event ("margin") is sent to all listeners.

Parameters:
m - the space between the border and the text

getMargin

public Insets getMargin()
Enabled: Returns the margin between the text component's border and its text.

Returns:
the margin

setNavigationFilter

public void setNavigationFilter(NavigationFilter filter)
Enabled: Sets the NavigationFilter. NavigationFilter is used by DefaultCaret and the default cursor movement actions as a way to restrict the cursor movement.

Since:
1.4

getNavigationFilter

public NavigationFilter getNavigationFilter()
Enabled: Returns the NavigationFilter. NavigationFilter is used by DefaultCaret and the default cursor movement actions as a way to restrict the cursor movement. A null return value implies the cursor movement and selection should not be restricted.

Returns:
the NavigationFilter
Since:
1.4

getCaret

public Caret getCaret()
Enabled: Fetches the caret that allows text-oriented navigation over the view.

Returns:
the caret

setCaret

public void setCaret(Caret c)
Enabled: Sets the caret to be used. By default this will be set by the UI that gets installed. This can be changed to a custom caret if desired. Setting the caret results in a PropertyChange event ("caret") being fired.

Parameters:
c - the caret
See Also:
getCaret()

getHighlighter

public Highlighter getHighlighter()
Enabled: Fetches the object responsible for making highlights.

Returns:
the highlighter

setHighlighter

public void setHighlighter(Highlighter h)
Enabled: Sets the highlighter to be used. By default this will be set by the UI that gets installed. This can be changed to a custom highlighter if desired. The highlighter can be set to null to disable it. A PropertyChange event ("highlighter") is fired when a new highlighter is installed.

Parameters:
h - the highlighter
See Also:
getHighlighter()

setKeymap

public void setKeymap(Keymap map)
Enabled: Sets the keymap to use for binding events to actions. Setting to null effectively disables keyboard input. A PropertyChange event ("keymap") is fired when a new keymap is installed.

Parameters:
map - the keymap
See Also:
getKeymap()

setDragEnabled

public void setDragEnabled(boolean b)
Enabled: Sets the dragEnabled property, which must be true to enable automatic drag handling (the first part of drag and drop) on this component. The transferHandler property needs to be set to a non-null value for the drag to do anything. The default value of the dragEnabled property is false.

When automatic drag handling is enabled, most look and feels begin a drag-and-drop operation whenever the user presses the mouse button over a selection and then moves the mouse a few pixels. Setting this property to true can therefore have a subtle effect on how selections behave.

Some look and feels might not support automatic drag and drop; they will ignore this property. You can work around such look and feels by modifying the component to directly call the exportAsDrag method of a TransferHandler.

Parameters:
b - the value to set the dragEnabled property to
Since:
1.4
See Also:
java.awt.GraphicsEnvironment#isHeadless, getDragEnabled(), JComponent.setTransferHandler(javax.swing.TransferHandler), TransferHandler

getDragEnabled

public boolean getDragEnabled()
Enabled: Gets the dragEnabled property.

Returns:
the value of the dragEnabled property
Since:
1.4
See Also:
setDragEnabled(boolean)

updateInputMap

void updateInputMap(Keymap oldKm,
                    Keymap newKm)
Updates the InputMaps in response to a Keymap change.

Parameters:
oldKm - the old Keymap
newKm - the new Keymap

getKeymap

public Keymap getKeymap()
Suppressed: Fetches the keymap currently active in this text component.

Returns:
the keymap

addKeymap

public static Keymap addKeymap(String nm,
                               Keymap parent)
Suppressed: Adds a new keymap into the keymap hierarchy. Keymap bindings resolve from bottom up so an attribute specified in a child will override an attribute specified in the parent.

Parameters:
nm - the name of the keymap (must be unique within the collection of named keymaps in the document); the name may be null if the keymap is unnamed, but the caller is responsible for managing the reference returned as an unnamed keymap can't be fetched by name
parent - the parent keymap; this may be null if unspecified bindings need not be resolved in some other keymap
Returns:
the keymap

removeKeymap

public static Keymap removeKeymap(String nm)
Enabled: Removes a named keymap previously added to the document. Keymaps with null names may not be removed in this way.

Parameters:
nm - the name of the keymap to remove
Returns:
the keymap that was removed

getKeymap

public static Keymap getKeymap(String nm)
Suppressed: Fetches a named keymap previously added to the document. This does not work with null-named keymaps.

Parameters:
nm - the name of the keymap
Returns:
the keymap

loadKeymap

public static void loadKeymap(Keymap map,
                              javax.swing.text.JTextComponent.KeyBinding[] bindings,
                              Action[] actions)
Suppressed:

Loads a keymap with a bunch of bindings. This can be used to take a static table of definitions and load them into some keymap. The following example illustrates an example of binding some keys to the cut, copy, and paste actions associated with a JTextComponent. A code fragment to accomplish this might look as follows:



   static final JTextComponent.KeyBinding[] defaultBindings = {
     new JTextComponent.KeyBinding(
       KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
       DefaultEditorKit.copyAction),
     new JTextComponent.KeyBinding(
       KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
       DefaultEditorKit.pasteAction),
     new JTextComponent.KeyBinding(
       KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
       DefaultEditorKit.cutAction),
   };

   JTextComponent c = new JTextPane();
   Keymap k = c.getKeymap();
   JTextComponent.loadKeymap(k, defaultBindings, c.getActions());
 
 
The sets of bindings and actions may be empty but must be non-null.

Parameters:
map - the keymap
bindings - the bindings
actions - the set of actions

isProcessInputMethodEventOverridden

private static Boolean isProcessInputMethodEventOverridden(Class klass)
Returns true if klass is NOT a JTextComponent and it or one of its superclasses (stoping at JTextComponent) overrides processInputMethodEvent. It is assumed this will be invoked from within a doPrivileged, and it is also assumed klass extends JTextComponent.


getCaretColor

public Color getCaretColor()
Enabled: Fetches the current color used to render the caret.

Returns:
the color

setCaretColor

public void setCaretColor(Color c)
Enabled: Sets the current color used to render the caret. Setting to null effectively restores the default color. Setting the color results in a PropertyChange event ("caretColor") being fired.

Parameters:
c - the color
See Also:
getCaretColor()

getSelectionColor

public Color getSelectionColor()
Enabled: Fetches the current color used to render the selection.

Returns:
the color

setSelectionColor

public void setSelectionColor(Color c)
Enabled: Sets the current color used to render the selection. Setting the color to null is the same as setting Color.white. Setting the color results in a PropertyChange event ("selectionColor").

Parameters:
c - the color
See Also:
getSelectionColor()

getSelectedTextColor

public Color getSelectedTextColor()
Enabled: Fetches the current color used to render the selected text.

Returns:
the color

setSelectedTextColor

public void setSelectedTextColor(Color c)
Enabled: Sets the current color used to render the selected text. Setting the color to null is the same as Color.black. Setting the color results in a PropertyChange event ("selectedTextColor") being fired.

Parameters:
c - the color
See Also:
getSelectedTextColor()

getDisabledTextColor

public Color getDisabledTextColor()
Enabled: Fetches the current color used to render the selected text.

Returns:
the color

setDisabledTextColor

public void setDisabledTextColor(Color c)
Enabled: Sets the current color used to render the disabled text. Setting the color fires off a PropertyChange event ("disabledTextColor").

Parameters:
c - the color
See Also:
getDisabledTextColor()

replaceSelection

public void replaceSelection(String content)
Enabled: Replaces the currently selected content with new content represented by the given string. If there is no selection this amounts to an insert of the given text. If there is no replacement text this amounts to a removal of the current selection.

This is the method that is used by the default implementation of the action for inserting content that gets bound to the keymap actions.

This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.

Parameters:
content - the content to replace the selection with

getText

public String getText(int offs,
                      int len)
               throws BadLocationException
Enabled: Fetches a portion of the text represented by the component. Returns an empty string if length is 0.

Parameters:
offs - the offset >= 0
len - the length >= 0
Returns:
the text
BadLocationException

modelToView

public Rectangle modelToView(int pos)
                      throws BadLocationException
Enabled: Converts the given location in the model to a place in the view coordinate system. The component must have a positive size for this translation to be computed (i.e. layout cannot be computed until the component has been sized). The component does not have to be visible or painted.

Parameters:
pos - the position >= 0
Returns:
the coordinates as a rectangle, with (r.x, r.y) as the location in the coordinate system, or null if the component does not yet have a positive size.
BadLocationException
See Also:
TextUI#modelToView

viewToModel

public int viewToModel(Point pt)
Enabled: Converts the given place in the view coordinate system to the nearest representative location in the model. The component must have a positive size for this translation to be computed (i.e. layout cannot be computed until the component has been sized). The component does not have to be visible or painted.

Parameters:
pt - the location in the view to translate
Returns:
the offset >= 0 from the start of the document, or -1 if the component does not yet have a positive size.
See Also:
TextUI#viewToModel

cut

public void cut()
Suppressed: Transfers the currently selected range in the associated text model to the system clipboard, removing the contents from the model. The current selection is reset. Does nothing for null selections.

See Also:
java.awt.Toolkit#getSystemClipboard, java.awt.datatransfer.Clipboard

copy

public void copy()
Suppressed: Transfers the currently selected range in the associated text model to the system clipboard, leaving the contents in the text model. The current selection remains intact. Does nothing for null selections.

See Also:
java.awt.Toolkit#getSystemClipboard, java.awt.datatransfer.Clipboard

paste

public void paste()
Suppressed: Transfers the contents of the system clipboard into the associated text model. If there is a selection in the associated view, it is replaced with the contents of the clipboard. If there is no selection, the clipboard contents are inserted in front of the current insert position in the associated view. If the clipboard is empty, does nothing.

See Also:
replaceSelection(java.lang.String), java.awt.Toolkit#getSystemClipboard, java.awt.datatransfer.Clipboard

invokeAction

private void invokeAction(String name,
                          Action altAction)
This is a conveniance method that is only useful for cut, copy and paste. If an Action with the name name does not exist in the ActionMap, this will attemp to install a TransferHandler and then use altAction.


installDefaultTransferHandlerIfNecessary

private void installDefaultTransferHandlerIfNecessary()
If the current TransferHandler is null, this will install a new one.


moveCaretPosition

public void moveCaretPosition(int pos)
Enabled: Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called. This forms a selection. If the document is null, does nothing. The position must be between 0 and the length of the component's text or else an exception is thrown.

Parameters:
pos - the position
See Also:
setCaretPosition(int)

setFocusAccelerator

public void setFocusAccelerator(char aKey)
Enabled: Sets the key accelerator that will cause the receiving text component to get the focus. The accelerator will be the key combination of the alt key and the character given (converted to upper case). By default, there is no focus accelerator key. Any previous key accelerator setting will be superseded. A '\0' key setting will be registered, and has the effect of turning off the focus accelerator. When the new key is set, a PropertyChange event (FOCUS_ACCELERATOR_KEY) will be fired.

Parameters:
aKey - the key
See Also:
getFocusAccelerator()

getFocusAccelerator

public char getFocusAccelerator()
Enabled: Returns the key accelerator that will cause the receiving text component to get the focus. Return '\0' if no focus accelerator has been set.

Returns:
the key

read

public void read(Reader in,
                 Object desc)
          throws IOException
Enabled: Initializes from a stream. This creates a model of the type appropriate for the component and initializes the model from the stream. By default this will load the model as plain text. Previous contents of the model are discarded.

Parameters:
in - the stream to read from
desc - an object describing the stream; this might be a string, a File, a URL, etc. Some kinds of documents (such as html for example) might be able to make use of this information; if non-null, it is added as a property of the document
IOException
See Also:
EditorKit.createDefaultDocument(), setDocument(javax.swing.text.Document), PlainDocument

write

public void write(Writer out)
           throws IOException
Enabled: Stores the contents of the model into the given stream. By default this will store the model as plain text.

Parameters:
out - the output stream
IOException

removeNotify

public void removeNotify()
Suppressed:

Overrides:
removeNotify in class JComponent
See Also:
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)

setCaretPosition

public void setCaretPosition(int position)
Enabled: Sets the position of the text insertion caret for the TextComponent. Note that the caret tracks change, so this may move if the underlying text of the component is changed. If the document is null, does nothing. The position must be between 0 and the length of the component's text or else an exception is thrown.

Parameters:
position - the position

getCaretPosition

public int getCaretPosition()
Enabled: Returns the position of the text insertion caret for the text component.

Returns:
the position of the text insertion caret for the text component >= 0

setText

public void setText(String t)
Enabled: Sets the text of this TextComponent to the specified text. If the text is null or empty, has the effect of simply deleting the old text. When text has been inserted, the resulting caret location is determined by the implementation of the caret class.

This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.

Parameters:
t - the new text to be set
See Also:
getText(int, int), DefaultCaret

getText

public String getText()
Enabled: Returns the text contained in this TextComponent. If the underlying document is null, will give a NullPointerException.

Returns:
the text
See Also:
setText(java.lang.String)

getSelectedText

public String getSelectedText()
Enabled: Returns the selected text contained in this TextComponent. If the selection is null or the document empty, returns null.

Returns:
the text
See Also:
setText(java.lang.String)

isEditable

public boolean isEditable()
Enabled: Returns the boolean indicating whether this TextComponent is editable or not.

Returns:
the boolean value
See Also:
setEditable(boolean)

setEditable

public void setEditable(boolean b)
Enabled: Sets the specified boolean to indicate whether or not this TextComponent should be editable. A PropertyChange event ("editable") is fired when the state is changed.

Parameters:
b - the boolean to be set
See Also:
isEditable()

getSelectionStart

public int getSelectionStart()
Enabled: Returns the selected text's start position. Return 0 for an empty document, or the value of dot if no selection.

Returns:
the start position >= 0

setSelectionStart

public void setSelectionStart(int selectionStart)
Enabled: Sets the selection start to the specified position. The new starting point is constrained to be before or at the current selection end.

This is available for backward compatibility to code that called this method on java.awt.TextComponent. This is implemented to forward to the Caret implementation which is where the actual selection is maintained.

Parameters:
selectionStart - the start position of the text >= 0

getSelectionEnd

public int getSelectionEnd()
Enabled: Returns the selected text's end position. Return 0 if the document is empty, or the value of dot if there is no selection.

Returns:
the end position >= 0

setSelectionEnd

public void setSelectionEnd(int selectionEnd)
Enabled: Sets the selection end to the specified position. The new end point is constrained to be at or after the current selection start.

This is available for backward compatibility to code that called this method on java.awt.TextComponent. This is implemented to forward to the Caret implementation which is where the actual selection is maintained.

Parameters:
selectionEnd - the end position of the text >= 0

select

public void select(int selectionStart,
                   int selectionEnd)
Enabled: Selects the text between the specified start and end positions.

This method sets the start and end positions of the selected text, enforcing the restriction that the start position must be greater than or equal to zero. The end position must be greater than or equal to the start position, and less than or equal to the length of the text component's text.

If the caller supplies values that are inconsistent or out of bounds, the method enforces these constraints silently, and without failure. Specifically, if the start position or end position is greater than the length of the text, it is reset to equal the text length. If the start position is less than zero, it is reset to zero, and if the end position is less than the start position, it is reset to the start position.

This call is provided for backward compatibility. It is routed to a call to setCaretPosition followed by a call to moveCaretPosition. The preferred way to manage selection is by calling those methods directly.

Parameters:
selectionStart - the start position of the text
selectionEnd - the end position of the text
See Also:
setCaretPosition(int), moveCaretPosition(int)

selectAll

public void selectAll()
Enabled: Selects all the text in the TextComponent. Does nothing on a null or empty document.


getToolTipText

public String getToolTipText(MouseEvent event)
Enabled: Returns the string to be used as the tooltip for event. This will return one of:
  1. If setToolTipText has been invoked with a non-null value, it will be returned, otherwise
  2. The value from invoking getToolTipText on the UI will be returned.
By default JTextComponent does not register itself with the ToolTipManager. This means that tooltips will NOT be shown from the TextUI unless registerComponent has been invoked on the ToolTipManager.

Overrides:
getToolTipText in class JComponent
Parameters:
event - the event in question
Returns:
the string to be used as the tooltip for event
See Also:
javax.swing.JComponent#setToolTipText, javax.swing.plaf.TextUI#getToolTipText, javax.swing.ToolTipManager#registerComponent

getPreferredScrollableViewportSize

public Dimension getPreferredScrollableViewportSize()
Enabled: Returns the preferred size of the viewport for a view component. This is implemented to do the default behavior of returning the preferred size of the component.

Specified by:
getPreferredScrollableViewportSize in interface Scrollable
Returns:
the preferredSize of a JViewport whose view is this Scrollable
See Also:
JComponent.getPreferredSize()

getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Enabled: 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. Ideally, components should handle a partially exposed row or column by returning the distance required to completely expose the item.

The default implementation of this is to simply return 10% of the visible area. Subclasses are likely to be able to provide a much more reasonable value.

Specified by:
getScrollableUnitIncrement in interface Scrollable
Parameters:
visibleRect - the view area visible within the viewport
orientation - either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL
direction - less than zero to scroll up/left, greater than zero for down/right
Returns:
the "unit" increment for scrolling in the specified direction
See Also:
JScrollBar.setUnitIncrement(int)

getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Enabled: 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.

The default implementation of this is to simply return the visible area. Subclasses will likely be able to provide a much more reasonable value.

Specified by:
getScrollableBlockIncrement in interface Scrollable
Parameters:
visibleRect - the view area visible within the viewport
orientation - either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL
direction - less than zero to scroll up/left, greater than zero for down/right
Returns:
the "block" increment for scrolling in the specified direction
See Also:
JScrollBar.setBlockIncrement(int)

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Enabled: Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport. For example a normal text view that supported line wrapping would return true here, since it would be undesirable for wrapped lines to disappear beyond the right edge of the viewport. Note that returning true for a Scrollable whose ancestor is a JScrollPane effectively disables horizontal scrolling.

Scrolling containers, like JViewport, will use this method each time they are validated.

Specified by:
getScrollableTracksViewportWidth in interface Scrollable
Returns:
true if a viewport should force the Scrollables width to match its own

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Enabled: Returns true if a viewport should always force the height of this Scrollable to match the height of the viewport. For example a columnar text view that flowed text in left to right columns could effectively disable vertical scrolling by returning true here.

Scrolling containers, like JViewport, will use this method each time they are validated.

Specified by:
getScrollableTracksViewportHeight in interface Scrollable
Returns:
true if a viewport should force the Scrollables height to match its own

getAccessibleContext

public AccessibleContext getAccessibleContext()
Suppressed: Gets the AccessibleContext associated with this JTextComponent. For text components, the AccessibleContext takes the form of an AccessibleJTextComponent. A new AccessibleJTextComponent instance is created if necessary.

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent
Returns:
an AccessibleJTextComponent that serves as the AccessibleContext of this JTextComponent

readObject

private void readObject(ObjectInputStream s)
                 throws IOException,
                        ClassNotFoundException
Description copied from class: JComponent
We use the ObjectInputStream "registerValidation" callback to update the UI for the entire tree of components after they've all been read in.

Parameters:
s - the ObjectInputStream from which to read
IOException
ClassNotFoundException
See Also:
ReadObjectCallback

paramString

protected String paramString()
Returns a string representation of this JTextComponent. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overriding paramString to provide information about the specific new aspects of the JFC components.

Overrides:
paramString in class JComponent
Returns:
a string representation of this JTextComponent

getFocusedComponent

static final JTextComponent getFocusedComponent()
Returns the JTextComponent that most recently had focus. The returned value may currently have focus.


getCurrentEventModifiers

private int getCurrentEventModifiers()

processInputMethodEvent

protected void processInputMethodEvent(InputMethodEvent e)
Description copied from class: Component
Processes input method events occurring on this component by dispatching them to any registered InputMethodListener objects.

This method is not called unless input method events are enabled for this component. Input method events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Overrides:
processInputMethodEvent in class Component
Parameters:
e - the input method event
See Also:
java.awt.event.InputMethodEvent, java.awt.event.InputMethodListener, Component.addInputMethodListener(java.awt.event.InputMethodListener), Component.enableEvents(long)

getInputMethodRequests

public java.awt.im.InputMethodRequests getInputMethodRequests()
Suppressed:

Overrides:
getInputMethodRequests in class Component
Returns:
the input method request handler for this component, null by default
See Also:
Component.addInputMethodListener(java.awt.event.InputMethodListener)

addInputMethodListener

public void addInputMethodListener(InputMethodListener l)
Suppressed:

Overrides:
addInputMethodListener in class Component
Parameters:
l - the input method listener
See Also:
java.awt.event.InputMethodEvent, java.awt.event.InputMethodListener, Component.removeInputMethodListener(java.awt.event.InputMethodListener), Component.getInputMethodListeners(), Component.getInputMethodRequests()

replaceInputMethodText

private void replaceInputMethodText(InputMethodEvent e)

createComposedString

private void createComposedString(int composedIndex,
                                  java.text.AttributedCharacterIterator text)

mapCommittedTextToAction

private void mapCommittedTextToAction(String committedText)

setInputMethodCaretPosition

private void setInputMethodCaretPosition(InputMethodEvent e)

exchangeCaret

private void exchangeCaret(Caret oldCaret,
                           Caret newCaret)

shouldSynthensizeKeyEvents

private boolean shouldSynthensizeKeyEvents()
Returns true if KeyEvents should be synthesized from an InputEvent.


isProcessInputMethodEventOverridden

private boolean isProcessInputMethodEventOverridden()

addKeymap

public static Keymap addKeymap()
Added: Safe replacement for the suppressed static addKeymap/2.



comments?