[EMAIL PROTECTED] wrote:
> Another thing that bothers me:
I thought i would get the Mnemonic working with a KeyEvent created by java, but the
KeyEvent objects returned are different from what is specified in the constructor,
and i cannot create an event with modifier=Alt.
i have sent it to a java list as it seems to be java but it may also be related the
java-linux problem...
================================================
The attached code outputs this:
alt key event: java.awt.event.KeyEvent[KEY_PRESSED,
keyCode=73,keyChar='I',modifiers=Ctrl] on frame0
How can i make it say KeyChar='i' and modifiers=Alt
?
thanks
jim watson
=============================================
import java.util.*;
import java.awt.*;
import java.awt.event.*;
public class Keys extends Frame implements KeyListener{
Keys(){
addKeyListener(this);
setSize(100,100);
setVisible(true);
makeKeyEvent();
}
public void keyPressed(KeyEvent k){
System.out.println(k);
}
public void keyReleased(KeyEvent k){}
public void keyTyped(KeyEvent k){}
public void makeKeyEvent(){
Date date = new Date();
long now = date.getTime();
KeyEvent myKey = new KeyEvent(this,
KeyEvent.KEY_PRESSED,
now,
KeyEvent.VK_ALT,
0x49) ;
System.out.println("alt key event: " + myKey.toString());
}
public static void main(String args[]){
Keys k = new Keys();
}
}