• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JScrollpane  RSS feed

 
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
 
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!