Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个名为“这是一个测试”的 JMenuItem。如果我想将它的助记符设置为“T”,它会自动在“This”中的第一个 T 下划线。我可以改变这个,所以它强调了“测试”中的T吗?
只需调用setDisplayedMnemonicIndex(int index)您的 JMenuItem 或从 AbstractButton 派生的类的任何对象。请参阅API 清单。
setDisplayedMnemonicIndex(int index)