| java.lang.Object java.awt.Component java.awt.TextComponent java.awt.TextArea
TextArea | public class TextArea extends TextComponent (Code) | | A TextArea object is a multi-line region
that displays text. It can be set to allow editing or
to be read-only.
The following image shows the appearance of a text area:
This text area could be created by the following line of code:
new TextArea("Hello", 5, 40);
version: 1.56, 08/19/02 author: Sami Shaio since: JDK1.0 |
Field Summary | |
final public static int | SCROLLBARS_BOTH Create and display both vertical and horizontal scrollbars. | final public static int | SCROLLBARS_HORIZONTAL_ONLY Create and display horizontal scrollbar only. | final public static int | SCROLLBARS_NONE Do not create or display any scrollbars for the text area. | final public static int | SCROLLBARS_VERTICAL_ONLY Create and display vertical scrollbar only. | int | columns The number of columns in the TextArea. | int | rows The number of rows in the TextArea. |
Constructor Summary | |
public | TextArea() Constructs a new text area. | public | TextArea(String text) Constructs a new text area with the specified text. | public | TextArea(int rows, int columns) Constructs a new empty text area with the specified number of
rows and columns. | public | TextArea(String text, int rows, int columns) Constructs a new text area with the specified text,
and with the specified number of rows and columns.
A column is an approximate average character
width that is platform-dependent. | public | TextArea(String text, int rows, int columns, int scrollbars) Constructs a new text area with the specified text,
and with the rows, columns, and scroll bar visibility
as specified.
The TextArea class defines several constants
that can be supplied as values for the
scrollbars argument:
SCROLLBARS_BOTH ,
SCROLLBARS_VERTICAL_ONLY ,
SCROLLBARS_HORIZONTAL_ONLY ,
and SCROLLBARS_NONE . |
Method Summary | |
public void | addNotify() Creates the TextArea's peer. | public void | append(String str) Appends the given text to the text area's current text. | public synchronized void | appendText(String str) | String | constructComponentName() Construct a name for this component. | public int | getColumns() Gets the number of columns in this text area. | public Dimension | getMinimumSize(int rows, int columns) Determines the minimum size of a text area with the specified
number of rows and columns.
Parameters: rows - the number of rows. Parameters: cols - the number of columns. | public Dimension | getMinimumSize() Determines the minimum size of this text area. | public Dimension | getPreferredSize(int rows, int columns) Determines the preferred size of a text area with the specified
number of rows and columns.
Parameters: rows - the number of rows. Parameters: cols - the number of columns. | public Dimension | getPreferredSize() Determines the preferred size of this text area. | public int | getRows() Gets the number of rows in the text area. | public int | getScrollbarVisibility() Gets an enumerated value that indicates which scroll bars
the text area uses. | public void | insert(String str, int pos) Inserts the specified text at the specified position
in this text area. | public synchronized void | insertText(String str, int pos) | public Dimension | minimumSize(int rows, int columns) | public Dimension | minimumSize() | protected String | paramString() Returns the parameter string representing the state of
this text area. | public Dimension | preferredSize(int rows, int columns) | public Dimension | preferredSize() | public void | replaceRange(String str, int start, int end) Replaces text between the indicated start and end positions
with the specified replacement text. | public synchronized void | replaceText(String str, int start, int end) | public void | setColumns(int columns) Sets the number of columns for this text area. | public void | setRows(int rows) Sets the number of rows for this text area. |
SCROLLBARS_BOTH | final public static int SCROLLBARS_BOTH(Code) | | Create and display both vertical and horizontal scrollbars.
since: JDK1.1 |
SCROLLBARS_HORIZONTAL_ONLY | final public static int SCROLLBARS_HORIZONTAL_ONLY(Code) | | Create and display horizontal scrollbar only.
since: JDK1.1 |
SCROLLBARS_NONE | final public static int SCROLLBARS_NONE(Code) | | Do not create or display any scrollbars for the text area.
since: JDK1.1 |
SCROLLBARS_VERTICAL_ONLY | final public static int SCROLLBARS_VERTICAL_ONLY(Code) | | Create and display vertical scrollbar only.
since: JDK1.1 |
columns | int columns(Code) | | The number of columns in the TextArea.
A column is an approximate average character
width that is platform-dependent.
This parameter will determine the text area's width.
Guaranteed to be non-negative.
See Also: getColumns() See Also: setColumns() |
rows | int rows(Code) | | The number of rows in the TextArea.
This parameter will determine the text area's height.
Guaranteed to be non-negative.
See Also: getRows() See Also: setRows() |
TextArea | public TextArea()(Code) | | Constructs a new text area.
This text area is created with scrollbar visibility equal to
TextArea.SCROLLBARS_BOTH , so both vertical and horizontal
scrollbars will be visible for this text area.
|
TextArea | public TextArea(String text)(Code) | | Constructs a new text area with the specified text.
This text area is created with scrollbar visibility equal to
TextArea.SCROLLBARS_BOTH , so both vertical and horizontal
scrollbars will be visible for this text area.
Parameters: text - the text to be displayed. |
TextArea | public TextArea(int rows, int columns)(Code) | | Constructs a new empty text area with the specified number of
rows and columns. A column is an approximate average character
width that is platform-dependent. The text area is created with
scrollbar visibility equal to
TextArea.SCROLLBARS_BOTH , so both
vertical and horizontal scrollbars will be visible for this
text area.
Parameters: rows - the number of rows Parameters: columns - the number of columns |
TextArea | public TextArea(String text, int rows, int columns)(Code) | | Constructs a new text area with the specified text,
and with the specified number of rows and columns.
A column is an approximate average character
width that is platform-dependent. The text area is created with
scrollbar visibility equal to
TextArea.SCROLLBARS_BOTH , so both
vertical and horizontal scrollbars will be visible for this
text area.
Parameters: text - the text to be displayed. Parameters: rows - the number of rows. Parameters: columns - the number of columns. |
TextArea | public TextArea(String text, int rows, int columns, int scrollbars)(Code) | | Constructs a new text area with the specified text,
and with the rows, columns, and scroll bar visibility
as specified.
The TextArea class defines several constants
that can be supplied as values for the
scrollbars argument:
SCROLLBARS_BOTH ,
SCROLLBARS_VERTICAL_ONLY ,
SCROLLBARS_HORIZONTAL_ONLY ,
and SCROLLBARS_NONE . Any other value for the
scrollbars argument is invalid and will result in
this text area being created with scrollbar visibility equal to
the default value of
TextArea.SCROLLBARS_BOTH .
Parameters: text - the text to be displayed. Iftext is null , the emptystring "" will be displayed. Parameters: rows - the number of rows. Ifrows is less than 0 ,rows is set to 0 . Parameters: columns - the number of columns. Ifcolumns is less than 0 ,columns is set to 0 . Parameters: scrollbars - a constant that determines whatscrollbars are created to view the text area. since: JDK1.1 |
addNotify | public void addNotify()(Code) | | Creates the TextArea's peer. The peer allows us to modify
the appearance of the TextArea without changing any of its
functionality.
|
appendText | public synchronized void appendText(String str)(Code) | | |
constructComponentName | String constructComponentName()(Code) | | Construct a name for this component. Called by getName() when the
name is null.
|
getMinimumSize | public Dimension getMinimumSize(int rows, int columns)(Code) | | Determines the minimum size of a text area with the specified
number of rows and columns.
Parameters: rows - the number of rows. Parameters: cols - the number of columns. the minimum dimensions required to displaythe text area with the specifiednumber of rows and columns. See Also: java.awt.Component.getMinimumSize since: JDK1.1 |
getPreferredSize | public Dimension getPreferredSize(int rows, int columns)(Code) | | Determines the preferred size of a text area with the specified
number of rows and columns.
Parameters: rows - the number of rows. Parameters: cols - the number of columns. the preferred dimensions required to displaythe text area with the specifiednumber of rows and columns. See Also: java.awt.Component.getPreferredSize since: JDK1.1 |
insertText | public synchronized void insertText(String str, int pos)(Code) | | |
paramString | protected String paramString()(Code) | | Returns the parameter string representing the state of
this text area. This string is useful for debugging.
the parameter string of this text area. |
replaceRange | public void replaceRange(String str, int start, int end)(Code) | | Replaces text between the indicated start and end positions
with the specified replacement text.
Parameters: str - the text to use as the replacement. Parameters: start - the start position. Parameters: end - the end position. See Also: java.awt.TextArea.insert since: JDK1.1 |
replaceText | public synchronized void replaceText(String str, int start, int end)(Code) | | |
Methods inherited from java.awt.Component | public boolean action(Event evt, Object what)(Code)(Java Doc) public synchronized void add(PopupMenu popup)(Code)(Java Doc) public synchronized void addComponentListener(ComponentListener l)(Code)(Java Doc) public synchronized void addFocusListener(FocusListener l)(Code)(Java Doc) public synchronized void addKeyListener(KeyListener l)(Code)(Java Doc) public synchronized void addMouseListener(MouseListener l)(Code)(Java Doc) public synchronized void addMouseMotionListener(MouseMotionListener l)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) boolean areInputMethodsEnabled()(Code)(Java Doc) public Rectangle bounds()(Code)(Java Doc) final void checkEnableNewEventsOnly(Object listener)(Code)(Java Doc) public int checkImage(Image image, ImageObserver observer)(Code)(Java Doc) public int checkImage(Image image, int width, int height, ImageObserver observer)(Code)(Java Doc) protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)(Code)(Java Doc) String constructComponentName()(Code)(Java Doc) public boolean contains(int x, int y)(Code)(Java Doc) public boolean contains(Point p)(Code)(Java Doc) public Image createImage(ImageProducer producer)(Code)(Java Doc) public Image createImage(int width, int height)(Code)(Java Doc) ComponentXWindow createXWindow()(Code)(Java Doc) public void deliverEvent(Event e)(Code)(Java Doc) public void disable()(Code)(Java Doc) final protected void disableEvents(long eventsToDisable)(Code)(Java Doc) final public void dispatchEvent(AWTEvent e)(Code)(Java Doc) void dispatchEventImpl(AWTEvent e)(Code)(Java Doc) public void doLayout()(Code)(Java Doc) public void enable()(Code)(Java Doc) public void enable(boolean b)(Code)(Java Doc) final protected synchronized void enableEvents(long eventsToEnable)(Code)(Java Doc) boolean eventEnabled(AWTEvent e)(Code)(Java Doc) Component findFocusDelegate(Container container)(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public Color getBackground()(Code)(Java Doc) public Rectangle getBounds()(Code)(Java Doc) public ColorModel getColorModel()(Code)(Java Doc) public Component getComponentAt(int x, int y)(Code)(Java Doc) public Component getComponentAt(Point p)(Code)(Java Doc) public Cursor getCursor()(Code)(Java Doc) Component getFocusDelegate()(Code)(Java Doc) public Font getFont()(Code)(Java Doc) Component getFontAndColorDelegate()(Code)(Java Doc) public FontMetrics getFontMetrics(Font font)(Code)(Java Doc) public Color getForeground()(Code)(Java Doc) public Graphics getGraphics()(Code)(Java Doc) InputContext getInputContext()(Code)(Java Doc) public Locale getLocale()(Code)(Java Doc) public Point getLocation()(Code)(Java Doc) public Point getLocationOnScreen()(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public String getName()(Code)(Java Doc) Container getNativeContainer()(Code)(Java Doc) public Container getParent()(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public Dimension getSize()(Code)(Java Doc) public Toolkit getToolkit()(Code)(Java Doc) final public Object getTreeLock()(Code)(Java Doc) public boolean gotFocus(Event evt, Object what)(Code)(Java Doc) public boolean handleEvent(Event evt)(Code)(Java Doc) public void hide()(Code)(Java Doc) public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)(Code)(Java Doc) public boolean inside(int x, int y)(Code)(Java Doc) public void invalidate()(Code)(Java Doc) static void invokeAndWait(Runnable runnable)(Code)(Java Doc) public boolean isDisplayable()(Code)(Java Doc) public boolean isEnabled()(Code)(Java Doc) public boolean isFocusTraversable()(Code)(Java Doc) public boolean isLightweight()(Code)(Java Doc) boolean isLightweightWhenDisplayable()(Code)(Java Doc) public boolean isOpaque()(Code)(Java Doc) public boolean isShowing()(Code)(Java Doc) public boolean isValid()(Code)(Java Doc) public boolean isVisible()(Code)(Java Doc) public boolean keyDown(Event evt, int key)(Code)(Java Doc) public boolean keyUp(Event evt, int key)(Code)(Java Doc) public void layout()(Code)(Java Doc) void lightweightPrint(Graphics g)(Code)(Java Doc) public void list()(Code)(Java Doc) public void list(PrintStream out)(Code)(Java Doc) public void list(PrintStream out, int indent)(Code)(Java Doc) public void list(PrintWriter out)(Code)(Java Doc) public void list(PrintWriter out, int indent)(Code)(Java Doc) public Component locate(int x, int y)(Code)(Java Doc) public Point location()(Code)(Java Doc) public boolean lostFocus(Event evt, Object what)(Code)(Java Doc) public Dimension minimumSize()(Code)(Java Doc) public boolean mouseDown(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseDrag(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseEnter(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseExit(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseMove(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseUp(Event evt, int x, int y)(Code)(Java Doc) public void move(int x, int y)(Code)(Java Doc) public void nextFocus()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) public void paintAll(Graphics g)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public boolean postEvent(Event e)(Code)(Java Doc) public Dimension preferredSize()(Code)(Java Doc) public boolean prepareImage(Image image, ImageObserver observer)(Code)(Java Doc) public boolean prepareImage(Image image, int width, int height, ImageObserver observer)(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printAll(Graphics g)(Code)(Java Doc) protected void processComponentEvent(ComponentEvent e)(Code)(Java Doc) protected void processEvent(AWTEvent e)(Code)(Java Doc) protected void processFocusEvent(FocusEvent e)(Code)(Java Doc) protected void processKeyEvent(KeyEvent e)(Code)(Java Doc) protected void processMouseEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc) public synchronized void remove(MenuComponent popup)(Code)(Java Doc) public synchronized void removeComponentListener(ComponentListener l)(Code)(Java Doc) public synchronized void removeFocusListener(FocusListener l)(Code)(Java Doc) public synchronized void removeKeyListener(KeyListener l)(Code)(Java Doc) public synchronized void removeMouseListener(MouseListener l)(Code)(Java Doc) public synchronized void removeMouseMotionListener(MouseMotionListener l)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public void repaint()(Code)(Java Doc) public void repaint(long tm)(Code)(Java Doc) public void repaint(int x, int y, int width, int height)(Code)(Java Doc) public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc) public void requestFocus()(Code)(Java Doc) public void reshape(int x, int y, int width, int height)(Code)(Java Doc) public void resize(int width, int height)(Code)(Java Doc) public void resize(Dimension d)(Code)(Java Doc) public void setBackground(Color c)(Code)(Java Doc) public void setBounds(int x, int y, int width, int height)(Code)(Java Doc) public void setBounds(Rectangle r)(Code)(Java Doc) public synchronized void setCursor(Cursor cursor)(Code)(Java Doc) public void setEnabled(boolean b)(Code)(Java Doc) public void setFont(Font f)(Code)(Java Doc) public void setForeground(Color c)(Code)(Java Doc) public void setLocale(Locale l)(Code)(Java Doc) public void setLocation(int x, int y)(Code)(Java Doc) public void setLocation(Point p)(Code)(Java Doc) public void setName(String name)(Code)(Java Doc) public void setSize(int width, int height)(Code)(Java Doc) public void setSize(Dimension d)(Code)(Java Doc) public void setVisible(boolean b)(Code)(Java Doc) public void show()(Code)(Java Doc) public void show(boolean b)(Code)(Java Doc) public Dimension size()(Code)(Java Doc) public String toString()(Code)(Java Doc) public void transferFocus()(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void validate()(Code)(Java Doc)
|
|
|