Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: AWT
Expertise: Beginner
Oct 2, 1998

Event handling with multiple scrollbars

Question:
I'm trying to work on the basics of event handling. I found it easy to set one label and have the scrollbar change the value of the label. I added a few more scrollbars, each with a separate label. When I move any scrollbar, only the first label value changes. How do you configure handleEvent to work with multiple scrollbars?

Answer:
Rather than override handleEvent, you should register an AdjustmentListener for each scrollbar and place the appropriate label value changing code in the AdjustmentListener's adjustmentValueChanged method.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date