File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Foreign language Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Foreign language" Watch "Foreign language" New topic
Author

Foreign language

Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
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

Joined: Sep 29, 2000
Posts: 8521

/* 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.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
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

Joined: Mar 15, 2000
Posts: 411
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

Joined: Sep 29, 2000
Posts: 8521
Have Fun
Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
Now if only I could map my numeric keypad to a bunch of these dead keys on boot up.
 
jQuery in Action, 2nd edition
 
subject: Foreign language