IT. Expert System.

Java Standard Edition (SE)

TextArea


java.awt

Class TextArea

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible


    public class TextArea
    extends TextComponent
    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:

    a textarea showing the word 'hello!'

    This text area could be created by the following line of code:


     new TextArea("Hello", 5, 40);
     

    Since:
    JDK1.0
    See Also:
    Serialized Form
    • Field Detail

      • SCROLLBARS_BOTH

        public static final int SCROLLBARS_BOTH
        Create and display both vertical and horizontal scrollbars.
        Since:
        JDK1.1
        See Also:
        Constant Field Values
      • SCROLLBARS_VERTICAL_ONLY

        public static final int SCROLLBARS_VERTICAL_ONLY
        Create and display vertical scrollbar only.
        Since:
        JDK1.1
        See Also:
        Constant Field Values
      • SCROLLBARS_HORIZONTAL_ONLY

        public static final int SCROLLBARS_HORIZONTAL_ONLY
        Create and display horizontal scrollbar only.
        Since:
        JDK1.1
        See Also:
        Constant Field Values
      • SCROLLBARS_NONE

        public static final int SCROLLBARS_NONE
        Do not create or display any scrollbars for the text area.
        Since:
        JDK1.1
        See Also:
        Constant Field Values
    • Constructor Detail

      • TextArea

        public TextArea(String text)
                 throws HeadlessException
        Constructs a new text area with the specified text. This text area is created with scrollbar visibility equal to SCROLLBARS_BOTH, so both vertical and horizontal scrollbars will be visible for this text area.
        Parameters:
        text - the text to be displayed; if text is null, the empty string "" will be displayed
        Throws:
        HeadlessException - if GraphicsEnvironment.isHeadless returns true
        See Also:
        GraphicsEnvironment.isHeadless()
      • TextArea

        public TextArea(int rows,
                        int columns)
                 throws HeadlessException
        Constructs a new text area with the specified number of rows and columns and the empty string as text. A column is an approximate average character width that is platform-dependent. The text area is created with scrollbar visibility equal to SCROLLBARS_BOTH, so both vertical and horizontal scrollbars will be visible for this text area.
        Parameters:
        rows - the number of rows
        columns - the number of columns
        Throws:
        HeadlessException - if GraphicsEnvironment.isHeadless returns true
        See Also:
        GraphicsEnvironment.isHeadless()
      • TextArea

        public TextArea(String text,
                        int rows,
                        int columns)
                 throws HeadlessException
        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 SCROLLBARS_BOTH, so both vertical and horizontal scrollbars will be visible for this text area.
        Parameters:
        text - the text to be displayed; if text is null, the empty string "" will be displayed
        rows - the number of rows
        columns - the number of columns
        Throws:
        HeadlessException - if GraphicsEnvironment.isHeadless returns true
        See Also:
        GraphicsEnvironment.isHeadless()
      • TextArea

        public TextArea(String text,
                        int rows,
                        int columns,
                        int scrollbars)
                 throws HeadlessException
        Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified. All TextArea constructors defer to this one.

        The TextArea class defines several constants that can be supplied as values for the scrollbars argument:

        • SCROLLBARS_BOTH,
        • SCROLLBARS_VERTICAL_ONLY,
        • SCROLLBARS_HORIZONTAL_ONLY,
        • 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 SCROLLBARS_BOTH.
        Parameters:
        text - the text to be displayed; if text is null, the empty string "" will be displayed
        rows - the number of rows; if rows is less than 0, rows is set to 0
        columns - the number of columns; if columns is less than 0, columns is set to 0
        scrollbars - a constant that determines what scrollbars are created to view the text area
        Throws:
        HeadlessException - if GraphicsEnvironment.isHeadless returns true
        Since:
        JDK1.1
        See Also:
        GraphicsEnvironment.isHeadless()
    • Method Detail

      • addNotify

        public void addNotify()
        Creates the TextArea's peer. The peer allows us to modify the appearance of the TextArea without changing any of its functionality.
        Overrides:
        addNotify in class TextComponent
        See Also:
        TextComponent.removeNotify()
      • insertText

        @Deprecated
        public void insertText(String str,
                                           int pos)
        Deprecated. As of JDK version 1.1, replaced by insert(String, int).
      • append

        public void append(String str)
        Appends the given text to the text area's current text.

        Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior.

        Parameters:
        str - the non-null text to append
        Since:
        JDK1.1
        See Also:
        insert(java.lang.String, int)
      • appendText

        @Deprecated
        public void appendText(String str)
        Deprecated. As of JDK version 1.1, replaced by append(String).
      • replaceRange

        public void replaceRange(String str,
                                 int start,
                                 int end)
        Replaces text between the indicated start and end positions with the specified replacement text. The text at the end position will not be replaced. The text at the start position will be replaced (unless the start position is the same as the end position). The text position is zero-based. The inserted substring may be of a different length than the text it replaces.

        Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior.

        Parameters:
        str - the non-null text to use as the replacement
        start - the start position
        end - the end position
        Since:
        JDK1.1
        See Also:
        insert(java.lang.String, int)
      • replaceText

        @Deprecated
        public void replaceText(String str,
                                            int start,
                                            int end)
        Deprecated. As of JDK version 1.1, replaced by replaceRange(String, int, int).
      • getRows

        public int getRows()
        Returns the number of rows in the text area.
        Returns:
        the number of rows in the text area
        Since:
        JDK1
        See Also:
        setRows(int), getColumns()
      • setRows

        public void setRows(int rows)
        Sets the number of rows for this text area.
        Parameters:
        rows - the number of rows
        Throws:
        IllegalArgumentException - if the value supplied for rows is less than 0
        Since:
        JDK1.1
        See Also:
        getRows(), setColumns(int)
      • getColumns

        public int getColumns()
        Returns the number of columns in this text area.
        Returns:
        the number of columns in the text area
        See Also:
        setColumns(int), getRows()
      • setColumns

        public void setColumns(int columns)
        Sets the number of columns for this text area.
        Parameters:
        columns - the number of columns
        Throws:
        IllegalArgumentException - if the value supplied for columns is less than 0
        Since:
        JDK1.1
        See Also:
        getColumns(), setRows(int)
      • getPreferredSize

        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
        columns - the number of columns
        Returns:
        the preferred dimensions required to display the text area with the specified number of rows and columns
        Since:
        JDK1.1
        See Also:
        Component.getPreferredSize()
      • preferredSize

        @Deprecated
        public Dimension preferredSize(int rows,
                                                   int columns)
        Deprecated. As of JDK version 1.1, replaced by getPreferredSize(int, int).
      • getMinimumSize

        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
        columns - the number of columns
        Returns:
        the minimum dimensions required to display the text area with the specified number of rows and columns
        Since:
        JDK1.1
        See Also:
        Component.getMinimumSize()
      • minimumSize

        @Deprecated
        public Dimension minimumSize(int rows,
                                                 int columns)
        Deprecated. As of JDK version 1.1, replaced by getMinimumSize(int, int).
      • paramString

        protected String paramString()
        Returns a string representing the state of this TextArea. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
        Overrides:
        paramString in class TextComponent
        Returns:
        the parameter string of this text area
      • getAccessibleContext

        public AccessibleContext getAccessibleContext()
        Returns the AccessibleContext associated with this TextArea. For text areas, the AccessibleContext takes the form of an AccessibleAWTTextArea. A new AccessibleAWTTextArea instance is created if necessary.
        Specified by:
        getAccessibleContext in interface Accessible
        Overrides:
        getAccessibleContext in class TextComponent
        Returns:
        an AccessibleAWTTextArea that serves as the AccessibleContext of this TextArea
        Since:
        1.3


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 304 / 158691342. Delta: 0.04163 с