Example usage for Java javax.swing JTextArea fields, constructors, methods, implement or subclass
The text is from its open source code.
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. |
Component | add(Component comp) Appends the specified component to the end of this container. |
void | addCaretListener(CaretListener listener) Adds a caret listener for notification of any changes to the caret. |
void | addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void | addHierarchyListener(HierarchyListener l) Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes. |
void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component. |
void | addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component. |
void | append(String str) Appends the given text to the end of the document. |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
AccessibleContext | getAccessibleContext() Gets the AccessibleContext associated with this JTextArea. |
ActionMap | getActionMap() Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. |
Action[] | getActions() Fetches the command list for the editor. |
Color | getBackground() Gets the background color of this component. |
Border | getBorder() Returns the border of this component or null if no border is currently set. |
int | getCaretPosition() Returns the position of the text insertion caret for the text component. |
int | getColumns() Returns the number of columns in the TextArea. |
Document | getDocument() Fetches the model associated with the editor. |
Font | getFont() Gets the font of this component. |
FontMetrics | getFontMetrics(Font font) Gets the FontMetrics for the specified Font . |
Graphics | getGraphics() Returns this component's graphics context, which lets you draw on a component. |
Highlighter | getHighlighter() Fetches the object responsible for making highlights. |
InputMap | getInputMap() Returns the InputMap that is used when the component has focus. |
Insets | getInsets() If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets . |
Keymap | getKeymap() Fetches the keymap currently active in this text component. |
int | getLineCount() Determines the number of lines contained in the area. |
int | getLineEndOffset(int line) Determines the offset of the end of the given line. |
int | getLineOfOffset(int offset) Translates an offset into the components text to a line number. |
int | getLineStartOffset(int line) Determines the offset of the start of the given line. |
boolean | getLineWrap() Gets the line-wrapping policy of the text area. |
String | getName() Gets the name of the component. |
Dimension | getPreferredSize() Returns the preferred size of the TextArea. |
int | getRows() Returns the number of rows in the TextArea. |
String | getSelectedText() Returns the selected text contained in this TextComponent . |
int | getSelectionEnd() Returns the selected text's end position. |
int | getSelectionStart() Returns the selected text's start position. |
Dimension | getSize() Returns the size of this component in the form of a Dimension object. |
int | getTabSize() Gets the number of characters used to expand tabs. |
String | getText() Returns the text contained in this TextComponent . |
String | getText(int offs, int len) Fetches a portion of the text represented by the component. |
TransferHandler | getTransferHandler() Gets the transferHandler property. |
boolean | getWrapStyleWord() Gets the style of wrapping used if the text area is wrapping lines. |
void | grabFocus() Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. |
void | insert(String str, int pos) Inserts the specified text at the specified position. |
Rectangle | modelToView(int pos) Converts the given location in the model to a place in the view coordinate system. |
void | moveCaretPosition(int pos) Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called. |
void | paint(Graphics g) Invoked by Swing to draw components. |
void | paste() Transfers the contents of the system clipboard into the associated text model. |
boolean | print(final MessageFormat headerFormat, final MessageFormat footerFormat, final boolean showPrintDialog, final PrintService service, final PrintRequestAttributeSet attributes, final boolean interactive) Prints the content of this JTextComponent . |
void | read(Reader in, Object desc) Initializes from a stream. |
void | repaint() Repaints this component. |
void | replaceRange(String str, int start, int end) Replaces text from the indicated start to end position with the new text specified. |
void | replaceSelection(String content) Replaces the currently selected content with new content represented by the given string. |
void | requestFocus() Requests that this Component gets the input focus. |
boolean | requestFocusInWindow() Requests that this Component gets the input focus. |
void | revalidate() Supports deferred automatic layout. |
void | select(int selectionStart, int selectionEnd) Selects the text between the specified start and end positions. |
void | selectAll() Selects all the text in the TextComponent . |
void | setAlignmentX(float alignmentX) Sets the horizontal alignment. |
void | setAutoscrolls(boolean autoscrolls) Sets the autoscrolls property. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setBounds(int x, int y, int width, int height) Moves and resizes this component. |
void | setCaret(Caret c) Sets the caret to be used. |
void | setCaretColor(Color c) Sets the current color used to render the caret. |
void | setCaretPosition(int position) Sets the position of the text insertion caret for the TextComponent . |
void | setColumns(int columns) Sets the number of columns for this TextArea. |
void | setComponentPopupMenu(JPopupMenu popup) Sets the JPopupMenu for this JComponent . |
void | setCursor(Cursor cursor) Sets the cursor image to the specified cursor. |
void | setDocument(Document doc) Associates the editor with a text document. |
void | setDragEnabled(boolean b) Turns on or off automatic drag handling. |
void | setEditable(boolean b) Sets the specified boolean to indicate whether or not this TextComponent should be editable. |
void | setEnabled(boolean enabled) Sets whether or not this component is enabled. |
void | setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value. |
void | setFocusTraversalKeys(int id, Set extends AWTKeyStroke> keystrokes) Sets the focus traversal keys for a given traversal operation for this Component. |
void | setFont(Font f) Sets the current font. |
void | setForeground(Color fg) Sets the foreground color of this component. |
void | setKeymap(Keymap map) Sets the keymap to use for binding events to actions. |
void | setLineWrap(boolean wrap) Sets the line-wrapping policy of the text area. |
void | setLocation(int x, int y) Moves this component to a new location. |
void | setMargin(Insets m) Sets margin space between the text component's border and its text. |
void | setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value. |
void | setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value. |
void | setName(String name) Sets the name of the component to the specified string. |
void | setNavigationFilter(NavigationFilter filter) Sets the NavigationFilter . |
void | setOpaque(boolean isOpaque) If true the component paints every pixel within its bounds. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setRows(int rows) Sets the number of rows for this TextArea. |
void | setSelectedTextColor(Color c) Sets the current color used to render the selected text. |
void | setSelectionColor(Color c) Sets the current color used to render the selection. |
void | setSelectionEnd(int selectionEnd) Sets the selection end to the specified position. |
void | setSelectionStart(int selectionStart) Sets the selection start to the specified position. |
void | setSize(int width, int height) Resizes this component so that it has width width and height height . |
void | setSize(Dimension d) Resizes this component so that it has width d.width and height d.height . |
void | setTabSize(int size) Sets the number of characters to expand tabs to. |
void | setText(String t) Sets the text of this TextComponent to the specified text. |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(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. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |
void | setWrapStyleWord(boolean word) Sets the style of wrapping used if the text area is wrapping lines. |
void | show() |
void | transferFocus() Transfers the focus to the next component, as though this Component were the focus owner. |
void | transferFocusBackward() Transfers the focus to the previous component, as though this Component were the focus owner. |
int | viewToModel(Point pt) Converts the given place in the view coordinate system to the nearest representative location in the model. |
void | write(Writer out) Stores the contents of the model into the given stream. |