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

cannot find symbol

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is sort of GUI-related, but I think it's really a basic Java question so I'm posting here. I've got the following code that is trying to create a simple numeric entry box:

When I go to compile this, I get the following error from the Java compiler:

com\FEIZyfer\Comm2Mon\Main.java:793: cannot find symbol
symbol : method addPropertyChangeListener(java.lang.String,com.FEIZyfer.comm2mon.controlPanelPane)
location: class javax.swing.JFormattedTextField
antdField.addPropertyChangeListener("value", this);

It seems that the compiler doesn't know what addPropertyChangeListener is. But this is right out of the example on (Sun's site. I checked all my import statements and they look OK. Thoughts?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FormattedTextFieldDemo.java compiles OK for me, but if I comment out this line

//import java.beans.PropertyChangeListener;

your error message is reproduced
 
Jeff Allison
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


FormattedTextFieldDemo.java compiles OK for me, but if I comment out this line

//import java.beans.PropertyChangeListener;

your error message is reproduced



Thanks for the reply, Michael. I have java.beans.PropertyChangeListener imported (amongst other things):



The Sun example (FormattedTextFieldDemo.java) compiles for me as well, so there's something different in the files. But I can't tell what.
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure that your class implements PropertyChangeListener -- without seeing your class in its entirity, I think that this is the most likely cause of the error.
 
Jeff Allison
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Make sure that your class implements PropertyChangeListener



Thanks Joel. That was it. I had forgotten to add that to the class definition.
 
Liar, liar, pants on fire! refreshing plug:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic