4

How do set a shortcut, eg. Ctrl+Q, to a JButton? JMenuItem has setAccelerator() method to set one, but JButton doesn't.

Rendicahya
  • 4,205
  • 7
  • 36
  • 56
  • 4
    Look at this answer: http://stackoverflow.com/questions/8588145/create-hot-keys-for-jbutton-in-java-using-swing – nevster Mar 19 '15 at 13:27

1 Answers1

0

Well, you can do a JMenu with a set og instruction, putting inside them the same ActionPerformed you put in the specified JButton. It's a good trade-off