Results 1 to 7 of 7
Thread: Char to keycode=not working?
- 05-20-2012, 09:08 PM #1
Member
- Join Date
- May 2012
- Posts
- 4
- Rep Power
- 0
Char to keycode=not working?
Here's my code:
if(deli.length() == 1) {
char tmp1 = deli.charAt(0);
int tmp2 = tmp1;
system.out.println("The keycode for "+deli+" is: "+ Integer.toString(tmp2));
}else{
system.out.println("Invalid amount of characters.");
}
It gives me a keycode but, it's not what the right keycode, for instance, I need Z to be 44, but it gives me 90. I get the 44 from using LWJGL's Keyboard.KEY_Z variable.
I can't figure it out for the life of me.
Help?
NOTE* this is for a game mod, that why it has LWJGL.
- 05-20-2012, 09:14 PM #2
Re: Char to keycode=not working?
Why do they call it rush hour when nothing moves? - Robin Williams
- 05-20-2012, 09:16 PM #3
Re: Char to keycode=not working?
The Java char type is an integral type. The integer value of 'Z' is 90.
If you need to get 44, just subtract 46.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 05-20-2012, 09:19 PM #4
Member
- Join Date
- May 2012
- Posts
- 4
- Rep Power
- 0
Re: Char to keycode=not working?
I almost put it in there but, I decided not to, I tested with other characters, and the values are all different.
- 05-20-2012, 09:28 PM #5
Member
- Join Date
- May 2012
- Posts
- 4
- Rep Power
- 0
Re: Char to keycode=not working?
Upon further research, 44 is the linux keycode for Z, but I'm on windows, how would i convert the keycodes over?
- 05-20-2012, 09:37 PM #6
Member
- Join Date
- May 2012
- Posts
- 4
- Rep Power
- 0
Get linux keycodes from Char?
Keycode Table
I need those, for instance, Z is 44 there, but using conventional methods, I get 90, which is windows. Help? This is very urgent for me, no one on skype, or another forum can help me.
- 05-20-2012, 10:31 PM #7
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,606
- Rep Power
- 5
Similar Threads
-
"boolean isDigit(char ch)" not working...please help
By cc11rocks in forum New To JavaReplies: 7Last Post: 02-06-2011, 01:40 AM -
How can I supress keycode?
By cjmartin in forum AWT / SwingReplies: 7Last Post: 08-06-2010, 06:00 PM -
replaceALL(char oldChar, char newChar) method
By arson09 in forum New To JavaReplies: 0Last Post: 04-28-2010, 05:48 AM -
Different keycode values
By dswastik in forum CLDC and MIDPReplies: 0Last Post: 01-29-2009, 03:44 PM -
drawing char by char with Graphics
By diggitydoggz in forum New To JavaReplies: 5Last Post: 12-27-2008, 12:49 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks