void (@NotNull JFormattedTextField field) { if (SystemInfoRt.isMac) { final int commandKeyMask; try { commandKeyMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); } catch (HeadlessException e) { return; } final InputMap inputMap = field.getInputMap(); final KeyStroke copyKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, commandKeyMask); inputMap.put(copyKeyStroke, "copy-to-clipboard"); final KeyStroke pasteKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, commandKeyMask); inputMap.put(pasteKeyStroke, "paste-from-clipboard"); final KeyStroke cutKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, commandKeyMask); inputMap.put(cutKeyStroke, "cut-to-clipboard"); } }