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.
我注意到在某些 Mac 上,JMenuItem 使用“空格”一词来表示空格键是键绑定。在其他 mac 上,使用了一个符号(看起来像一个短大写 U)。我更喜欢“空间”演示,因为它对用户更透明。有没有办法覆盖 LAF 以图形方式表示加速键的方式?
您可以子类BasicMenuItemUI化并覆盖该paintMenuItem()方法。在那里你可以画出你自己的加速器。我想要一个动画图像作为加速器:)
BasicMenuItemUI
paintMenuItem()
(注意如果您只是想更改助记词或加速器,那么您可以直接使用setAccelerator()或其他设置方法。但我假设情况并非如此。)
setAccelerator()