Java javax.swing.text JTextComponent fields, constructors, methods, implement or subclass

Example usage for Java javax.swing.text JTextComponent fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing.text JTextComponent.

The text is from its open source code.

Field

StringDEFAULT_KEYMAP
The default keymap that will be shared by all JTextComponent instances unless they have had a different keymap set.

Method

Componentadd(Component comp)
Appends the specified component to the end of this container.
voidaddCaretListener(CaretListener listener)
Adds a caret listener for notification of any changes to the caret.
voidaddFocusListener(FocusListener l)
Adds the specified focus listener to receive focus events from this component when this component gains input focus.
voidaddInputMethodListener(InputMethodListener l)
voidaddKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
KeymapaddKeymap(String nm, Keymap parent)
Adds a new keymap into the keymap hierarchy.
voidaddMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
voidcopy()
Transfers the currently selected range in the associated text model to the system clipboard, leaving the contents in the text model.
voidcut()
Transfers the currently selected range in the associated text model to the system clipboard, removing the contents from the model.
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
ActionMapgetActionMap()
Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding.
Action[]getActions()
Fetches the command list for the editor.
ColorgetBackground()
Gets the background color of this component.
CaretgetCaret()
Fetches the caret that allows text-oriented navigation over the view.
ColorgetCaretColor()
Fetches the current color used to render the caret.
intgetCaretPosition()
Returns the position of the text insertion caret for the text component.
ClassgetClass()
Returns the runtime class of this Object .
ObjectgetClientProperty(Object key)
Returns the value of the property with the specified key.
JPopupMenugetComponentPopupMenu()
Returns JPopupMenu that assigned for this component.
ColorgetDisabledTextColor()
Fetches the current color used to render the disabled text.
DocumentgetDocument()
Fetches the model associated with the editor.
SetgetFocusTraversalKeys(int id)
Returns the Set of focus traversal keys for a given traversal operation for this Container.
FontgetFont()
Gets the font of this component.
FontMetricsgetFontMetrics(Font font)
Gets the FontMetrics for the specified Font.
ColorgetForeground()
Gets the foreground color of this component.
HighlightergetHighlighter()
Fetches the object responsible for making highlights.
InputContextgetInputContext()
Gets the input context used by this component for handling the communication with input methods when text is entered in this component.
InputMapgetInputMap()
Returns the InputMap that is used when the component has focus.
InputMapgetInputMap(int condition)
Returns the InputMap that is used during condition.
InsetsgetInsets()
If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets.
KeymapgetKeymap()
Fetches the keymap currently active in this text component.
KeymapgetKeymap(String nm)
Fetches a named keymap previously added to the document.
StringgetName()
Gets the name of the component.
StringgetSelectedText()
Returns the selected text contained in this TextComponent.
ColorgetSelectedTextColor()
Fetches the current color used to render the selected text.
ColorgetSelectionColor()
Fetches the current color used to render the selection.
intgetSelectionEnd()
Returns the selected text's end position.
intgetSelectionStart()
Returns the selected text's start position.
StringgetText()
Returns the text contained in this TextComponent.
StringgetText(int offs, int len)
Fetches a portion of the text represented by the component.
ToolkitgetToolkit()
Gets the toolkit of this component.
TextUIgetUI()
Fetches the user-interface factory for this text-oriented editor.
intgetWidth()
Returns the current width of this component.
booleanisEditable()
Returns the boolean indicating whether this TextComponent is editable or not.
booleanisEnabled()
Determines whether this component is enabled.
voidloadKeymap(Keymap map, KeyBinding[] bindings, Action[] actions)

Loads a keymap with a bunch of bindings.

RectanglemodelToView(int pos)
Converts the given location in the model to a place in the view coordinate system.
voidmoveCaretPosition(int pos)
Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called.
voidpaste()
Transfers the contents of the system clipboard into the associated text model.
voidputClientProperty(Object key, Object value)
Adds an arbitrary key/value "client property" to this component.
voidread(Reader in, Object desc)
Initializes from a stream.
voidremoveCaretListener(CaretListener listener)
Removes a caret listener.
voidreplaceSelection(String content)
Replaces the currently selected content with new content represented by the given string.
voidrequestFocus()
Requests that this Component gets the input focus.
booleanrequestFocusInWindow()
Requests that this Component gets the input focus.
voidselect(int selectionStart, int selectionEnd)
Selects the text between the specified start and end positions.
voidselectAll()
Selects all the text in the TextComponent.
voidsetBackground(Color bg)
Sets the background color of this component.
voidsetBorder(Border border)
Sets the border of this component.
voidsetCaretColor(Color c)
Sets the current color used to render the caret.
voidsetCaretPosition(int position)
Sets the position of the text insertion caret for the TextComponent.
voidsetComponentPopupMenu(JPopupMenu popup)
Sets the JPopupMenu for this JComponent.
voidsetCursor(Cursor cursor)
Sets the cursor image to the specified cursor.
voidsetDocument(Document doc)
Associates the editor with a text document.
voidsetDragEnabled(boolean b)
Turns on or off automatic drag handling.
voidsetEditable(boolean b)
Sets the specified boolean to indicate whether or not this TextComponent should be editable.
voidsetEnabled(boolean enabled)
Sets whether or not this component is enabled.
voidsetFocusable(boolean focusable)
Sets the focusable state of this Component to the specified value.
voidsetFocusTraversalKeys(int id, Set keystrokes)
Sets the focus traversal keys for a given traversal operation for this Component.
voidsetFont(Font font)
Sets the font for this component.
voidsetForeground(Color fg)
Sets the foreground color of this component.
voidsetSelectionColor(Color c)
Sets the current color used to render the selection.
voidsetSelectionEnd(int selectionEnd)
Sets the selection end to the specified position.
voidsetSelectionStart(int selectionStart)
Sets the selection start to the specified position.
voidsetText(String t)
Sets the text of this TextComponent to the specified text.
voidsetToolTipText(String text)
Registers the text to display in a tool tip.
voidvalidate()
Validates this container and all of its subcomponents.
intviewToModel(Point pt)
Converts the given place in the view coordinate system to the nearest representative location in the model.
voidwrite(Writer out)
Stores the contents of the model into the given stream.