• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ChangeListener cannot be resolved to a type

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's been a while since I've grappled with Java so I'm a bit rusty. I've got a feeling there may be a simple explanation to my problem...

My 'TestPanel' class extends JPanel. In the constructor for 'TestPanel' I have added a JSlider object called 'slider' to my panel. I now wish to write a private class called 'SliderListener' that implements ChangeListener then I can add a listener to my slider.

Unfortunately my IDE tells me that ChangeListener cannot be resolved to a type. Have I imported the correct packages or is there some other reason ChangeListener is not recognised?

Here is my code...


 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hugh Roarty wrote:Unfortunately my IDE tells me that ChangeListener cannot be resolved to a type. Have I imported the correct packages or is there some other reason ChangeListener is not recognised?


Have you looked up the API for ChangeListener? You'll find the package mentioned there. (Hint: no, you haven't imported it.)
 
Hugh Roarty
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Darryl,

Its so long since I've wrote code that I forgot how useful the API is...

import javax.swing.event.*;
 
reply
    Bookmark Topic Watch Topic
  • New Topic