• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to disable the automatic scrolling of JScrollPane?

 
Marvin Legend
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a chat application and I have a JTextArea inside a JScrollPane, I want to trigger any event (button, checkbox, etc.) and this ScrollPane would not be more automatic, because the user can not read messages that have passed, because the bar always goes down when a new message arrives, so I created a check box to mark when the user does not want automatic scrolling. If you know something better, help me a lot!

I searched some forums and have not found it, thank you very much for your help.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out JTextComponent#setCaretPosition(int position)
GUI questions are best suited on the GUI forum. Moving...
 
Darryl Burke
Bartender
Posts: 5153
11
Java Netbeans IDE Opera
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marvin Legend wrote:If you know something better, help me a lot!

I searched some forums and have not found it, thank you very much for your help.

Maybe you missed this one
Stop JScrollPane Scrolling If Knob Is Not At Bottom
 
Marvin Legend
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:
Marvin Legend wrote:If you know something better, help me a lot!

I searched some forums and have not found it, thank you very much for your help.

Maybe you missed this one
Stop JScrollPane Scrolling If Knob Is Not At Bottom



Wow ! very nice bro ! Thanks ! thanks !

Uhuuuuuu !!!

 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Smart Scrolling for a slightly more flexible approach. The above code only works on a JTextArea (not a JTextPane for example) because a JTextArea doesn't use any margins for painting.
 
Marvin Legend
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:Check out Smart Scrolling for a slightly more flexible approach. The above code only works on a JTextArea (not a JTextPane for example) because a JTextArea doesn't use any margins for painting.


Very good bro !
Thanks ! Thanks !
Congratulations !
Take my Like !
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!