java键盘mac_java – 使用Nimbus LAF的Mac键盘快捷键

有没有办法在OS X上使用Nimbus LAF(外观和感觉),同时仍然可以使用Meta键进行剪切/复制/粘贴和选择所有操作?

我目前在我的Swing应用程序的main方法中有以下代码,它根据操作系统更改了LAF(OS X的默认值,所有其他的Nimbus):

if (!System.getProperty("os.name", "").startsWith("Mac OS X")) {

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}

}

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(LicenseInspectorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(LicenseInspectorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(LicenseInspectorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(LicenseInspectorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

}

我这样做是一种解决方法,因为Nimbus会覆盖OS X上的剪切/复制/粘贴和select-all的键盘快捷键(Meta键与Ctrl键).如果只是键盘快捷键没有被覆盖,我宁愿一直使用Nimbus.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值