java中JTextArea中的参数表示什么意思?
答案:2 悬赏:10
解决时间 2021-03-22 14:22
- 提问者网友:末路
- 2021-03-22 05:21
java中JTextArea中的参数表示什么意思?
最佳答案
- 二级知识专家网友:想偏头吻你
- 2021-03-22 05:35
两个参数分别表示行和列;
JTextArea是多行文本容器,可以实现对文本的自动换行。
用setText(String text)方法向JTextArea内写入文字,再用getText方法可以得到这里的文字。
setLineWrap(true)方法为自动换行,既当文字比控件的宽度还长时会自动换行。
setCaretPosition(0)将光标定往到容器的第一个字符处,这个方法一般是当读取大量的文字后能让容器从头开始显示文字,否则容器会将光标定位在最后一个个字符处,显示的当然也是文字的未尾。
JTextArea是多行文本容器,可以实现对文本的自动换行。
用setText(String text)方法向JTextArea内写入文字,再用getText方法可以得到这里的文字。
setLineWrap(true)方法为自动换行,既当文字比控件的宽度还长时会自动换行。
setCaretPosition(0)将光标定往到容器的第一个字符处,这个方法一般是当读取大量的文字后能让容器从头开始显示文字,否则容器会将光标定位在最后一个个字符处,显示的当然也是文字的未尾。
全部回答
- 1楼网友:动情书生
- 2021-03-22 06:39
JTextArea
public JTextArea(int rows,
int columns)
Constructs a new empty TextArea with the specified number of rows and columns. A default model is created, and the initial string is null.
Parameters:
rows - the number of rows >= 0
columns - the number of columns >= 0
Throws:
IllegalArgumentException - if the rows or columns arguments are negative.
行 和 列
public JTextArea(int rows,
int columns)
Constructs a new empty TextArea with the specified number of rows and columns. A default model is created, and the initial string is null.
Parameters:
rows - the number of rows >= 0
columns - the number of columns >= 0
Throws:
IllegalArgumentException - if the rows or columns arguments are negative.
行 和 列
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯