Hi

I have setup mnemonic keys on all my buttons and now want to try and get them to do something - at the moment this is just writing a string to the console, but eventually it will be calling another method.

For example, one of my buttons has:

startButton = new javax.swing.JButton();
startButton.setBackground(buttonColour);
startButton.setFont(new java.awt.Font("MS Sans Serif", 1, 16));
startButton.setForeground(buttonFontColour);
startButton.setMnemonic('s');
startButton.setToolTipText("Start new search");
startButton.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
startButton.setText("START SEARCH");
startButton.setPreferredSize(new java.awt.Dimension(160, 25));
gamePanel.add(startButton);

I have been looking this up for the past three hours and am now a bit lost!

I have looked up the KeyListener and then tried using the keyTyped or the keyPressed method. I now see that perhaps I should alter the line startButton.setMnemonic('s'); to something like startButton.setMnemonic(KeyEvent.VK_S);

I also want it to accept upper or lowercase.

Can anyone help with this please?