Sets the Swing look and feel.
(LookAndFeel newLookAndFeel)
| 57 | |
| 58 | /** Sets the Swing look and feel. */ |
| 59 | @AstroImageJ(reason = "update keymapping on mac for copy/paste", modified = true) |
| 60 | public static void setLookAndFeel(LookAndFeel newLookAndFeel) { |
| 61 | if (IJ.isMacOSX()) { |
| 62 | InputMap im = (InputMap) UIManager.get("TextField.focusInputMap"); |
| 63 | im.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.META_DOWN_MASK), DefaultEditorKit.copyAction); |
| 64 | im.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.META_DOWN_MASK), DefaultEditorKit.pasteAction); |
| 65 | im.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.META_DOWN_MASK), DefaultEditorKit.cutAction); |
| 66 | } |
| 67 | if (!IJ.isWindows() || newLookAndFeel==null) |
| 68 | return; |
| 69 | try { |
| 70 | UIManager.setLookAndFeel(newLookAndFeel); |
| 71 | } catch(Throwable t) {} |
| 72 | } |
| 73 | |
| 74 | /** Returns the current Swing look and feel or null. */ |
| 75 | public static LookAndFeel getLookAndFeel() { |