Java examples for Swing:Menu
Setting a Keyboard Accelerator for a Menu Item
import java.awt.event.KeyEvent; import javax.swing.JMenuItem; import javax.swing.KeyStroke; public class Main { public static void main(String[] argv) { JMenuItem item = new JMenuItem("Item"); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.SHIFT_MASK));//ww w . j ava2 s . c o m } }