Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event listener not responding

 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't want to put all the code up, just what I think is relevant. Basically, I have a JTextField called productCode, but the Look Up button isn't getting the text and processing it.. I don't know what's wrong. Let me know if more code is needed.

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based only on what we can see here, of course: when the bolded line is executed, lookUpHandler is null. I don't see where you ever construct an instance of ButtonHandler to store into it.

An aside: why are all your members static? If you're initializing them in a constructor, then they needn't be, nor should they be, static.
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of it was something the teacher passed out. She wanted us to use JPanel. She says that code is "more elegant."

so..

I'll try that.
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works! Thanks.

ur the greatest
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic