Java Swing - Using JScrollPane and Having it scroll back to top

前端 未结 7 975
[愿得一人]
[愿得一人] 2020-12-09 00:52

I\'m using JScrollPane to allow scrolling in a JFrame that has a text component that\'s serving as a text editor. What I want to do, after setting the text in this editor,

7条回答
  •  鱼传尺愫
    2020-12-09 01:09

    You can use the method setCaretPosition(0) just after setText(String t) of your text component.

提交回复
热议问题