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

Scrollbar  RSS feed

 
Jackie Davis
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have 3 scrollbars

Is there a way to determine specifcally which scrollbar has been adjusted?



For example, if Scrollbar sb2 is adjusted, I only want to do someMethod(v2). At the minute my code does all 3 methods.

Please help

Thanks
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
evt.getSource() will give you the actual source where the eventt occured
You can use something like

JScrollBar bar = (JScrollBar) evt.getSource();
if(bar == sb1)
{
//do Something for Scroll Bar 1
}
if(bar == sb2)
{
//do Something for Scroll Bar 2
}
if(bar == sb3)
{
//do Something for Scroll Bar 3
}

Hope that it helps!!
 
Jackie Davis
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very helpful!! Thanks

This is one fine community!
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just keep the Good will floating and help others ;-)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!