默认情况下,如何在JTextPane中将内容滚动到底部? [英] How to scroll the contents to bottom by default in JTextPane?

查看:72
本文介绍了默认情况下,如何在JTextPane中将内容滚动到底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的窗口上有JTextPane,我有JTextField.当我在JTextField中按Enter键时,文本将添加到JTextPane中.一切正常,滚动条也单独显示.但是,它显示不正确.它会自动滚动到JTextPane中内容的开头.如何将滚动条保持在JTextPane的末尾?

I have JTextPane on my window and i have JTextField. When i press enter enter in JTextField, the text gets added in JTextPane. Everything works fine and scrollbar too appears on its own. But, it doesn't appear properly. It automatically scrolls to the beginning of the content in JTextPane. How do i keep the scrollbar to the end of JTextPane?

推荐答案

我发现了有关同一问题的讨论.看看 http://www.coderanch. com/t/329964/GUI/java/JScrollpane-Force-autoscroll-bottom

I found a discussion of the same problem. Have a look at http://www.coderanch.com/t/329964/GUI/java/JScrollpane-Force-autoscroll-bottom

这篇关于默认情况下,如何在JTextPane中将内容滚动到底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆