Hi all,
I have extended JButton to myButton
this is my constructor
myButton(String text,char key){
this(text);
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Character.toUpperCase(key)),"Action");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Character.toLowerCase(key)),"Action");
this.getActionMap().put("Action",action);
this.setMnemonic((int) Character.toUpperCase(key));
}
I m using single key shortcut for the myButton
and i am using setToolTipText(String)
But when i hover it shows me like this
"Move Tool Unknown KeyCode: 0x0" (1.png)
And if when i dont set the key shortcut it displays normal
(2.png)
Whats the problem??