• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JScrollpane

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic