首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

JTextPane或JTextPane设置了滚动条,文本增加后,滚动条自动上滑

2012-12-24 
JTextPane或JTextPane设置了滚动条,文本增加后,滚动条自动下滑JTextPane或JTextPane设置了滚动条,文本增加

JTextPane或JTextPane设置了滚动条,文本增加后,滚动条自动下滑

JTextPane或JTextPane设置了滚动条,文本增加后,滚动条自动下滑

例如:日志打印窗口,日志增加后,滚动条自动下滑,显示最新的日志。

实现方法:将光标移动到文本的最后。

JTextArea的实现:

//实现垂直滚动条自动下滑到最低端msgShowTxtPane.setCaretPosition(msgShowTxtPane.getStyledDocument().getLength());

?

热点排行