Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollpane  RSS feed

 
sandeep mathur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can someone please explain me how JScrollPane works. In JScrollPane we use ComponentListener which has the callback method which sets the scrollbar position.
Here I am not able to understand that how do we generate the event which causes the ComponentListener to readjust the scrollbar.

Thank you.
Sandeep
 
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
You do not need to explicitly fire an events. Just wrap your component inside the JScrollPane embed it inside the container and you are all set to go.
In case you haven't done so, it might be a good idea to read http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html
 
sandeep mathur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maneesh,

Thanks for the reply.

Actually, I am writing a custom Scroll pane similar to JScrollPane. I have added the ComponentListener to the view of scrollpane. But, I am not able to understand how the events will be fired.
I have added the JList in the scrollpane but it is not scrolling. Should I change the y position of the list to generate the ComponentListener callback which will readjust the scrollbar postion.

Thanks,
Sandeep
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!