What I'm trying to do is to prevent Cut/Copy/Paste on a JTree, because I want all node-moving to be done via drag and drop.
Copy and Paste are already prevented in the canImport and importData methods of the handler, but I can't think how to prevent Cut.
In addition, all these didn't work:
Tree.getActionMap().put( "cut", null );
InputMap inputMap = Tree.getInputMap(JComponent.WHEN_FOCUSED);
inputMap.put(KeyStroke.getKeyStroke('X', java.awt.event.InputEvent.CTRL_MASK), null);
ActionMap actionMap = Tree.getActionMap();
actionMap.put("cut", null);
This works for me:
ActionMap actionMap = tree.getActionMap();
actionMap.remove("cut");
actionMap.getParent().remove("cut");
actionMap.remove("copy");
actionMap.getParent().remove("copy");
actionMap.remove("paste");
actionMap.getParent().remove("paste");