/* * @param text the text to be displayed; if * <code>text</code> is <code>null</code>, the empty * string <code>""</code> will be displayed * @param rows the number of rows; if * <code>rows</code> is less than <code>0</code>, * <code>rows</code> is set to <code>0</code> * @param columns the number of columns; if * <code>columns</code> is less than <code>0</code>, * <code>columns</code> is set to <code>0</code> * @param scrollbars a constant that determines what * scrollbars are created to view the text area */
TextArea(String text, int rows, int columns, int scrollbars) 构造一个新文本区,该文本区具有指定的文本(text),以及指定的行数(rows)、列数(columns)和滚动条可见性(scrollbars)。 TextArea.SCROLLBARS_VERTICAL_ONLY 意思是只创建并显示垂直滚动条。
/*
* @param text the text to be displayed; if
* <code>text</code> is <code>null</code>, the empty
* string <code>""</code> will be displayed
* @param rows the number of rows; if
* <code>rows</code> is less than <code>0</code>,
* <code>rows</code> is set to <code>0</code>
* @param columns the number of columns; if
* <code>columns</code> is less than <code>0</code>,
* <code>columns</code> is set to <code>0</code>
* @param scrollbars a constant that determines what
* scrollbars are created to view the text area
*/
构造一个新文本区,该文本区具有指定的文本(text),以及指定的行数(rows)、列数(columns)和滚动条可见性(scrollbars)。 TextArea.SCROLLBARS_VERTICAL_ONLY 意思是只创建并显示垂直滚动条。
dsfdsfdsf
dfdsfdsfdsf
sdfsdfdsfds
你看这上面的是几行
再看看上面的这个行都有几个字符----一个字是一列
构造一个新文本区,该文本区具有指定的文本,以及指定的行数、列数和滚动条可见性。
先查API
看书
不懂再百度Google
……
public TextArea(String text,
int rows,
int columns,
int scrollbars)
throws HeadlessException构造一个新文本区,该文本区具有指定的文本,以及指定的行数、列数和滚动条可见性。所有 TextArea 构造方法都服从这一规定。
TextArea 类定义一些可以作为 scrollbars 参数值提供的常量: SCROLLBARS_BOTH,
SCROLLBARS_VERTICAL_ONLY,
SCROLLBARS_HORIZONTAL_ONLY,
SCROLLBARS_NONE.
其他所有用于 scrollbars 参数的值都是无效的,并会使创建此文本区时使用的滚动条可见性等于 SCROLLBARS_BOTH 的默认值。 参数:
text - 要显示的文本;如果 text 为 null,则显示空字符串 ""
rows - 行数;如果 rows 小于 0,则将 rows 设置为 0
columns - 列数;如果 columns 小于 0,则将 columns 设置为 0
scrollbars - 确定为查看文本区创建的滚动条类型的常量
抛出:
HeadlessException - 如果 GraphicsEnvironment.isHeadless 返回 true
从以下版本开始:
JDK1.1
另请参见:
GraphicsEnvironment.isHeadless()这种问题自己要查一下API很简单的!!!