import javax.swing.JButton; import javax.swing.JCheckBox; public class Main { public static void main(String[] argv) throws Exception { JButton button = new JButton("Button"); button.setMnemonic('B'); JCheckBox checkBox = new JCheckBox("CheckBox"); checkBox.setMnemonic('C'); } }