0

I have a JTextPane in my program. In I like to show the HTML code. Since the JTextPane supports the HTML tag.

But the JTextPane Auto Scrolls to the bottom. I Don't want it to auto scroll

I there any suggestion how to prevent it from autoscrolling.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Are you continually adding text, or do you do it one time? – matt Sep 15 '21 at 08:06
  • [Java Swing - Using JScrollPane and Having it scroll back to top](https://stackoverflow.com/questions/291115/java-swing-using-jscrollpane-and-having-it-scroll-back-to-top) – Gilbert Le Blanc Sep 15 '21 at 09:56
  • No! I'm not continuously adding text. I add it just one time. Well. For more information I use netbeans IDE. I just drag and drop the text pane after i get html code stored in my database and uses setText() method to add the code to textPane. It works fine. Just scrolls to bottom. That What I don't want. – Abdul Rehman Sep 16 '21 at 16:34
  • Well... Thanks..Your above links worked fine. I got my problem solved. – Abdul Rehman Sep 16 '21 at 16:45

0 Answers0