Just remove all J :-P
e.g.
JMenuItem = MenuItem
JMenuBar = MenuBar
setJMenuBar = setMenuBar
e.t.c
This can be done because swing has JMenuItem and awt has MenuItem e.t.c.
The line I had to change more was:
itemExit.setShortcut(
new MenuShortcut(
new KeyEvent
(this, 1 , 1 ,
KeyEvent.CTRL_MASK , KeyEvent.VK_X ,
KeyEvent.CHAR_UNDEFINED ).getKeyCode()
));
which became like this :
itemExit.setAccelerator(
KeyStroke.getKeyStroke (KeyEvent.VK_X, KeyEvent.CTRL_MASK)
);
or it could be:
itemExit.setShortcut(
new MenuShortcut(KeyStroke.getKeyStroke("X").getKeyCode())
);
That's all for now. That worked for me.
If you have any other similar problem please leave it as comment to help others too.
Thank you for visiting.
No comments:
Post a Comment