如何在java中的textArea中新添加的文本末尾自动显示插入符?
可能的重复:
自动滚动到文本区域的底部 < /p>
I有 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);
Possible Duplicate:
Automatically scroll to the bottom of a text area
I have TextArea component. In different situation i should append text to it.I want Caret to be appears at the end of new appended text and if text is to large, automatically scrolling down.
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
希望这段代码可以在某种程度上帮助您。您只需执行此操作
并换行文本,以便它向下滚动,因为长度超过实际视图使用
这里是一个示例程序供您理解
希望这对您有一些帮助。
问候
Hopefully this code might help you in some way. You just have to do this
and for wraping the text, so that it scrolls down, as the length is more than the actual view use
Here is a sample Program for your understanding
Hope this be of some help to you.
Regards