activating mnemonic keys on my buttons
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.setFont(new java.awt.Font("MS Sans Serif", 1, 16));
startButton.setToolTipText("Start new search");
startButton.setPreferredSize(new java.awt.Dimension(160, 25));
I have been looking this up for the past three hours and am now a bit lost! :SICK:
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?
Here is the code for image display
I've zipped it.
I have laid out some java source that might be useful here:
PS: you may want to remove the package directive on top.