Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ImageJ, converting AWT to SWING  RSS feed

 
Robert Hickman
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For our Senior Design Project we are converting ImageJ's interface from AWT to SWING. The main problem is that we are not sure how to change MenuShortcut, or what the equivalent is in SWING. Any help would be greatly appreciated. Thanks!

 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Swing's equivalent of MenuShortCut is setting the accelerator for a JMenuItem. For instance, to set CTRL+A:
I personally prefer to use the first way of creating key strokes, but the second one reads more naturally. It's also easier to make mistakes with, in which case null is returned.

It's also possible to combine modifiers using a bitwise OR. To change from CTRL+A to CTRL+ALT+A:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!