Setting a Keyboard Accelerator for a Menu Item : Accessible « Swing JFC « Java






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) throws Exception {

    JMenuItem item = new JMenuItem("Item");
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.SHIFT_MASK));
  }
}

   
  








Related examples in the same category

1.implement Accessible to make your object accessible
2.Setting an Accessible Name for an Image Button
3.Setting a Description for Image Icons
4.Setting a Mnemonic for Buttons for Accessible
5.Setting a Mnemonic for a Menu for Accessible
6.Associating a Label with a Component
7.A GUI to show accessible information coming from the components in an
8.An example of getting the Accessible information from a Button objectAn example of getting the Accessible information from a Button object
9.Has Displayed Name