• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol, method getKeyChar()

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Selected code snippet:

Error:
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your question? The error seems pretty self-explanatory. Take a minute to read it.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:What is your question? The error seems pretty self-explanatory. Take a minute to read it.

Here is my full code snippet:

I need to be able to use e.getKeyChar(). Why isn't this working? I looked at the error code and cannot figure it out.
cc11rocks
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error says it can't find getKeyChar() in the java.beans.PropertyChangeEvent class. Take a look at the API.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:The error says it can't find getKeyChar() in the java.beans.PropertyChangeEvent class. Take a look at the API.

Is there some way around this? Is there another way to do this? Do you even get what I am trying to do? yummy and stupid are JFormattedTextFields.
Thanks,
cc11rocks
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, I don't know what you're trying to do. It helps if you TellTheDetails.
 
Mohamed Sanaulla
Bartender
Posts: 3166
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you looking for: KeyListener and addKeyListener
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:Nope, I don't know what you're trying to do. It helps if you TellTheDetails.

I want to check if the input is a number. If it's not, I don't want it showing up. Hence,

I don't want it showing up if it's not a number. This code:

Checks if the input is a number. If it's not, it returns false, and is supposed to revert. Hopefully now you have a better understanding of what I want. yummy and stupid are JFormattedTextFields.
Thanks,
cc11rock
 
Mohamed Sanaulla
Bartender
Posts: 3166
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to be using the Correct listener there. Did you read the KeyListener I had linked in my previous post?
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohamed Sanaulla wrote:I think you need to be using the Correct listener there. Did you read the KeyListener I had linked in my previous post?


Still not doing anything. I did the System.out.println check and it seems to be working, just not the:

and

part.
John Price
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!