Topic: 如何把JTextArea里的内容清空或用其他字符串赋值?还有怎么设成不可编辑?

  Print this page

1.如何把JTextArea里的内容清空或用其他字符串赋值?还有怎么设成不可编辑? Copy to clipboard
Posted by: shsen
Posted on: 2003-04-04 11:36

该类里没有这些方法,只有一个replaceRange(String str, int start, int end),但那个end好象很难知道用什么值。我要全部替换。

2.Re:如何把JTextArea里的内容清空或用其他字符串赋值?还有怎么设成不可编辑? [Re: shsen] Copy to clipboard
Posted by: jiangns3000
Posted on: 2003-04-04 13:16

JTextArea TA1 = new JTextArea();
1)清空:
TA1.setText("");
2)其它串如:Str1
TA1.setText(Str1);
3)不可编辑:
TA1.setEditable(false);

3.Re:如何把JTextArea里的内容清空或用其他字符串赋值?还有怎么设成不可编辑? [Re: shsen] Copy to clipboard
Posted by: snowbug
Posted on: 2003-04-05 06:20

JTextArea is the sub-class of JTextComponent so you can use all the method defined in the JTextComponent, such as setText(null), setEditable(boolean), etc.

4.Re:如何把JTextArea里的内容清空或用其他字符串赋值?还有怎么设成不可编辑? [Re: shsen] Copy to clipboard
Posted by: looker
Posted on: 2003-04-08 22:01

shsen,java api doc is very helpful. Recommend you to download and take it as reference while coding. You can find all of the api you want .

5.Re:如何把JTextArea里的内容清空或用其他字符串赋值?还有怎么设成不可编辑? [Re: looker] Copy to clipboard
Posted by: Jove
Posted on: 2003-04-08 22:34

looker wrote:
shsen,java api doc is very helpful. Recommend you to download and take it as reference while coding. You can find all of the api you want .


nod, 不过我经常用的是chm格式的api doc, 好处是直接在索引栏中输入setSize,就会调转到相应的apidoc, 效率比较高
另外一个就是JBuilder加上ProductityPro插件, 显示光标的api doc


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923