MetaOS X で Nimbus LAF (ルック アンド フィール) を使用しながら、切り取り/コピー/貼り付けおよびすべて選択の操作にキーを使用する方法はありますか?
現在、Swing アプリのメイン メソッドに次のコードがあります。これは、オペレーティング システムに基づいて 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);
}
}
MetaNimbus は、OS X のカット/コピー/ペーストおよびすべて選択 (キー対Ctrlキー)のキーボード ショートカットをオーバーライドするため、回避策としてこれを行います。キーボード ショートカットだけがオーバーライドされていなければ、常に Nimbus を使用したいと思います。