Java JTextPane + JScrollPane: de/activate automatic scrolling

前端 未结 3 942
不思量自难忘°
不思量自难忘° 2021-01-20 06:06

I\'m currently writing a simple chat in Java and currently I\'m stuck on this problem: I want my output JTextPane to behave like you would expect it to from a good chat, ie

3条回答
  •  醉梦人生
    2021-01-20 06:47

    JScrollBar has getValue() method. Just warp it in SwingUtilities.invokeLater() to be called after text appending.

提交回复
热议问题