Java javax.swing JTextArea fields, constructors, methods, implement or subclass

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

Introduction

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

The text is from its open source code.

Subclass

javax.swing.JTextArea has subclasses.
Click this link to see all its subclasses.

Constructor

JTextArea(String text)
Constructs a new TextArea with the specified text displayed.
JTextArea(Document doc)
Constructs a new JTextArea with the given document model, and defaults for all of the other arguments (null, 0, 0).
JTextArea()
Constructs a new TextArea.
JTextArea(int rows, int columns)
Constructs a new empty TextArea with the specified number of rows and columns.
JTextArea(String text, int rows, int columns)
Constructs a new TextArea with the specified text and number of rows and columns.

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.
voidaddHierarchyListener(HierarchyListener l)
Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes.
voidaddKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
voidaddMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
voidaddMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.
voidaddMouseWheelListener(MouseWheelListener l)
Adds the specified mouse wheel listener to receive mouse wheel events from this component.
voidappend(String str)
Appends the given text to the end of the document.
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
AccessibleContextgetAccessibleContext()
Gets the AccessibleContext associated with this JTextArea.
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.
BordergetBorder()
Returns the border of this component or null if no border is currently set.
intgetCaretPosition()
Returns the position of the text insertion caret for the text component.
intgetColumns()
Returns the number of columns in the TextArea.
DocumentgetDocument()
Fetches the model associated with the editor.
FontgetFont()
Gets the font of this component.
FontMetricsgetFontMetrics(Font font)
Gets the FontMetrics for the specified Font.
GraphicsgetGraphics()
Returns this component's graphics context, which lets you draw on a component.
HighlightergetHighlighter()
Fetches the object responsible for making highlights.
InputMapgetInputMap()
Returns the InputMap that is used when the component has focus.
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.
intgetLineCount()
Determines the number of lines contained in the area.
intgetLineEndOffset(int line)
Determines the offset of the end of the given line.
intgetLineOfOffset(int offset)
Translates an offset into the components text to a line number.
intgetLineStartOffset(int line)
Determines the offset of the start of the given line.
booleangetLineWrap()
Gets the line-wrapping policy of the text area.
StringgetName()
Gets the name of the component.
DimensiongetPreferredSize()
Returns the preferred size of the TextArea.
intgetRows()
Returns the number of rows in the TextArea.
StringgetSelectedText()
Returns the selected text contained in this TextComponent.
intgetSelectionEnd()
Returns the selected text's end position.
intgetSelectionStart()
Returns the selected text's start position.
DimensiongetSize()
Returns the size of this component in the form of a Dimension object.
intgetTabSize()
Gets the number of characters used to expand tabs.
StringgetText()
Returns the text contained in this TextComponent.
StringgetText(int offs, int len)
Fetches a portion of the text represented by the component.
TransferHandlergetTransferHandler()
Gets the transferHandler property.
booleangetWrapStyleWord()
Gets the style of wrapping used if the text area is wrapping lines.
voidgrabFocus()
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window.
voidinsert(String str, int pos)
Inserts the specified text at the specified position.
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.
voidpaint(Graphics g)
Invoked by Swing to draw components.
voidpaste()
Transfers the contents of the system clipboard into the associated text model.
booleanprint(final MessageFormat headerFormat, final MessageFormat footerFormat, final boolean showPrintDialog, final PrintService service, final PrintRequestAttributeSet attributes, final boolean interactive)
Prints the content of this JTextComponent .
voidread(Reader in, Object desc)
Initializes from a stream.
voidrepaint()
Repaints this component.
voidreplaceRange(String str, int start, int end)
Replaces text from the indicated start to end position with the new text specified.
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.
voidrevalidate()
Supports deferred automatic layout.
voidselect(int selectionStart, int selectionEnd)
Selects the text between the specified start and end positions.
voidselectAll()
Selects all the text in the TextComponent.
voidsetAlignmentX(float alignmentX)
Sets the horizontal alignment.
voidsetAutoscrolls(boolean autoscrolls)
Sets the autoscrolls property.
voidsetBackground(Color bg)
Sets the background color of this component.
voidsetBorder(Border border)
Sets the border of this component.
voidsetBounds(int x, int y, int width, int height)
Moves and resizes this component.
voidsetCaret(Caret c)
Sets the caret to be used.
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.
voidsetColumns(int columns)
Sets the number of columns for this TextArea.
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 f)
Sets the current font.
voidsetForeground(Color fg)
Sets the foreground color of this component.
voidsetKeymap(Keymap map)
Sets the keymap to use for binding events to actions.
voidsetLineWrap(boolean wrap)
Sets the line-wrapping policy of the text area.
voidsetLocation(int x, int y)
Moves this component to a new location.
voidsetMargin(Insets m)
Sets margin space between the text component's border and its text.
voidsetMaximumSize(Dimension maximumSize)
Sets the maximum size of this component to a constant value.
voidsetMinimumSize(Dimension minimumSize)
Sets the minimum size of this component to a constant value.
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetNavigationFilter(NavigationFilter filter)
Sets the NavigationFilter.
voidsetOpaque(boolean isOpaque)
If true the component paints every pixel within its bounds.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component.
voidsetRows(int rows)
Sets the number of rows for this TextArea.
voidsetSelectedTextColor(Color c)
Sets the current color used to render the selected text.
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.
voidsetSize(int width, int height)
Resizes this component so that it has width width and height height .
voidsetSize(Dimension d)
Resizes this component so that it has width d.width and height d.height .
voidsetTabSize(int size)
Sets the number of characters to expand tabs to.
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.
voidsetTransferHandler(TransferHandler newHandler)
Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop.
voidsetVisible(boolean aFlag)
Makes the component visible or invisible.
voidsetWrapStyleWord(boolean word)
Sets the style of wrapping used if the text area is wrapping lines.
voidshow()
voidtransferFocus()
Transfers the focus to the next component, as though this Component were the focus owner.
voidtransferFocusBackward()
Transfers the focus to the previous component, as though this Component were the focus owner.
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.