swing如何在java中的textArea中新添加的文本末尾自动显示插入符号?
Possible Duplicate:
Automatically scroll to the bottom of a text area
我有TextArea组件。在不同的情况下,我应该附加文本。我希望插入符号出现在新附加文本的末尾,如果文本太大,则自动向下滚动
textAreaStatus = new WebTextArea(
"1- Click on the refresh icon to get newest file.\n" +
"2- Select destination if needed.\n" +
"3- Click download button to start downloading.\n");
textAreaStatus.setBackground(Color.black);
textAreaStatus.setCaretPosition(textAreaStatus.getText().length());
textAreaStatus.getCaret().setVisible(true);
# 1 楼答案
希望这段代码能对您有所帮助。你必须这么做
用于包装文本,使其向下滚动,因为长度超过实际视图使用的长度
下面是一个示例程序供您理解
希望这对你有所帮助
问候