Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Foreign language

 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does Java see foreign keys in the KeyEvent class? There's a nunch of VK_ fields set up but they're all for English keys. How would I check for someone entering 'a' with an accent etc.?
Thanks for any help.
Paul
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

/* For European keyboards */
public static final int VK_DEAD_GRAVE = 0x80;
public static final int VK_DEAD_ACUTE = 0x81;
public static final int VK_DEAD_CIRCUMFLEX = 0x82;
public static final int VK_DEAD_TILDE = 0x83;
public static final int VK_DEAD_MACRON = 0x84;
public static final int VK_DEAD_BREVE = 0x85;
public static final int VK_DEAD_ABOVEDOT = 0x86;
public static final int VK_DEAD_DIAERESIS = 0x87;
public static final int VK_DEAD_ABOVERING = 0x88;
public static final int VK_DEAD_DOUBLEACUTE = 0x89;
public static final int VK_DEAD_CARON = 0x8a;
public static final int VK_DEAD_CEDILLA = 0x8b;
public static final int VK_DEAD_OGONEK = 0x8c;
public static final int VK_DEAD_IOTA = 0x8d;
public static final int VK_DEAD_VOICED_SOUND = 0x8e;
public static final int VK_DEAD_SEMIVOICED_SOUND = 0x8f;

You know Paul, why don't you just go read this file instead of asking each key.
Go to your jdk1.3 file (or whatever). Find the src.jar file. Open it in WinZip or FileLibrarian or whatever. Find the KeyEvent class and extract it. Then you can read it in txt form to your hearts delight.
 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a good idea but what stopped me from doing it was, I thought it would be the .class version of the file - and I wouldn't be able to see anything.
So there's much more of the VK_ fields than I see in the documentation?
Between you and me Cindy, we'll pull through this project.
Thanks for all your help.
Paul
 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I've just learned something new. I always thought the src.jar file was full of class files but it's not. I suppose I should have known because it is the 'source'. So it's not actually used for anything. It just ships with the JDK.
Paul
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have Fun
 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now if only I could map my numeric keypad to a bunch of these dead keys on boot up.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic