开发者

Creating Button Shortcuts with Java like & (ampersand) with Windows Forms

开发者 https://www.devze.com 2023-02-04 08:27 出处:网络
I wish I could word this question better. Partly I just don\'t know the name of what I\'m looking for.

I wish I could word this question better. Partly I just don't know the name of what I'm looking for.

With Visual Studi开发者_如何学JAVAo and Windows forms you can add an ampersand to create a "shortcut" key to a button by pressing Alt + [That Letter]. Like My &Button ... Alt + B would be the shortcut.

Is there an equivalent of this in Java SWING? I am using NetBeans IDE 6.9.1.

Thank you all!


That's called a mnemonic.

Use setMnemonic (javadoc)

See http://download.oracle.com/javase/tutorial/uiswing/components/menu.html#mnemonic


You use JMenutItem.setMnemonic(); I don't think there's a handy-dandy shortcut like the ampersand.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号