public class JTextArea extends JTextComponent implements Scrollable
_bold, _caretPosition, _document, _editable_border_alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
JTextArea()
The default constructor creates an empty text area with 10 rows
and 10 columns.
|
JTextArea(java.lang.String text_)
Construct a text area with 10 rows and 10 columns, and containing
the specified text.
|
JTextArea(java.lang.String text_,
int rows_,
int columns_)
Construct a text area wth the specified number of rows and columns,
and containing the specified text.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addScrollListener(ScrollListener sl_)
Register a ScrollListener object for this JTextArea.
|
void |
append(java.lang.String text_)
Appends the specified text to the end of the document.
|
void |
debug(int level_) |
void |
draw()
Implements the abstract method in charva.awt.Component.
|
int |
getColumns()
Returns the number of columns in this JTextArea.
|
int |
getHeight() |
int |
getLineCount()
Returns the number of lines of text displayed in the JTextArea.
|
int |
getLineEndOffset(int line_)
Returns the offset of the last character in the specified line.
|
int |
getLineOfOffset(int offset_)
Translates an offset (relative to the start of the document)
to a line number.
|
int |
getLineStartOffset(int line_)
Returns the offset of the first character in the specified line
of text.
|
boolean |
getLineWrap()
Returns the line-wrapping policy of the JTextArea.
|
Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for this JTextArea
when it is in a JScrollPane (this method implements the
Scrollable interface).
|
int |
getRows()
Returns the number of rows in this JTextArea.
|
Dimension |
getSize()
Returns the size of this component.
|
int |
getWidth() |
boolean |
getWrapStyleWord()
Returns the line-wrapping style to be used if getLineWrap() is true.
|
void |
insert(java.lang.String text_,
int pos_)
Inserts the specified text at the specified position (ie at the
specified offset from the start of the document)..
|
Dimension |
minimumSize()
Called by the LayoutManager.
|
void |
processKeyEvent(KeyEvent ke_)
Process KeyEvents that have been generated by this JTextArea.
|
void |
processMouseEvent(MouseEvent e_)
Process a MouseEvent that was generated by clicking the mouse
somewhere inside this JTextArea.
|
void |
processScrollEvent(ScrollEvent e_)
Process scroll events generated by this JTextArea.
|
void |
removeScrollListener(ScrollListener sl_)
Remove a ScrollListener object that is registered for this JTextArea.
|
void |
replaceRange(java.lang.String text_,
int start_,
int end_)
Replaces the text from the specified start position to end position
with the specified text.
|
void |
requestFocus()
This method should be invoked by all subclasses of Component
which override this method; because this method generates the
FOCUS_GAINED event when the component gains the keyboard focus.
|
void |
setBounds(int top_,
int left_,
int bottom_,
int right_) |
void |
setBounds(Point topleft_,
Dimension size_) |
void |
setBounds(Rectangle bounds) |
void |
setCaretPosition(int caret_)
Sets the position of the text insertion caret for this JTextArea.
|
void |
setColumns(int columns_)
Sets the number of columns in this JTextArea.
|
void |
setLineWrap(boolean wrap_)
Sets the line-wrapping policy of the JTextArea.
|
void |
setRows(int rows_)
Sets the number of rows in this JTextArea.
|
void |
setWrapStyleWord(boolean wrapWord_)
Sets the line-wrapping style to be used if getLineWrap() is true.
|
getCaretPosition, getDocument, getText, isEditable, setDocument, setEditable, setFont, setTextgetBorder, getInsets, setBorderaddFocusListener, addKeyListener, contains, contains, getAlignmentX, getAlignmentY, getAncestorWindow, getBackground, getBounds, getCursesColor, getForeground, getLocation, getLocationOnScreen, getName, getParent, hasFocus, hide, invalidate, isDisplayed, isEnabled, isFocusTraversable, isRecursivelyVisible, isTotallyObscured, isValid, isVisible, processEvent, processFocusEvent, repaint, requestSync, setBackground, setEnabled, setForeground, setLocation, setLocation, setName, setParent, setVisible, show, validate, validateCursesColorclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocationpublic JTextArea()
public JTextArea(java.lang.String text_)
public JTextArea(java.lang.String text_,
int rows_,
int columns_)
public void setBounds(int top_,
int left_,
int bottom_,
int right_)
public void setColumns(int columns_)
public int getColumns()
public void setRows(int rows_)
public int getRows()
public Dimension getSize()
public void append(java.lang.String text_)
public void insert(java.lang.String text_,
int pos_)
public void replaceRange(java.lang.String text_,
int start_,
int end_)
public void setCaretPosition(int caret_)
setCaretPosition in class JTextComponentpublic int getLineCount()
public int getLineStartOffset(int line_)
public int getLineEndOffset(int line_)
public int getLineOfOffset(int offset_)
public void setLineWrap(boolean wrap_)
public boolean getLineWrap()
public void setWrapStyleWord(boolean wrapWord_)
public boolean getWrapStyleWord()
public Dimension minimumSize()
minimumSize in class Componentpublic void processKeyEvent(KeyEvent ke_)
processKeyEvent in class Componentpublic void processMouseEvent(MouseEvent e_)
processMouseEvent in class Componentpublic void draw()
draw in class JComponentpublic void requestFocus()
ComponentrequestFocus in class Componentpublic void addScrollListener(ScrollListener sl_)
addScrollListener in interface Scrollablepublic void removeScrollListener(ScrollListener sl_)
removeScrollListener in interface Scrollablepublic void processScrollEvent(ScrollEvent e_)
processScrollEvent in interface Scrollablepublic Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface Scrollable