We would like to know how to set Mnemonic key for JCheckBox.
// w ww.j a va2 s . c om import java.awt.FlowLayout; import java.awt.event.KeyEvent; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; public class Main { public static void main(String[] args) { JCheckBox a = new JCheckBox("A"); a.setSelected(true); a.setMnemonic(KeyEvent.VK_A); JCheckBox b = new JCheckBox("B"); JCheckBox c = new JCheckBox("C"); JCheckBox d = new JCheckBox("D"); JFrame frame = new JFrame(); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JLabel("Car Features")); frame.add(a); frame.add(b); frame.add(c); frame.add(d); frame.pack(); frame.setVisible(true); } }