There are a number of standard system actions available for use in NetBeans.
XXX no answer for arch-overall
SelectionType ANY in SaveAction
SaveAction has been modified to allow one or more
into it's context. The previous behavior was to allow EXACTLY_ONE.
Register your actions for
layer, don't use the deprecated manifest style.
HeapViewpreserves its settings between sessions
are now preserved between sessions in NBPreferences of the same corresponding names.
topComponent.getActionMap().put("jumpPrev", new YourPrevAction()); topComponent.getActionMap().put("jumpNext", new YourNextAction());if your component provides items and you want the user to jump among them using standard next/prev actions.
This method should be more convenient than looking for an instance in lookup. Also there is a simple implementation for standalone use available.
In order for the action to show up in Keyboards Shortcut dialog you need the action defined in the layer file under "Actions" folder and have the shortcut defined there under "Keymaps/<Profile Name>" linking to your action.
<folder name="Actions" > <folder name="Window"> <file name="org-netbeans-core-actions-PreviousViewCallbackAction.instance"/> </folder> </folder> <folder name="Keymaps"> <folder name="NetBeans"> <file name="S-A-Left.shadow"> <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-actions-PreviousViewCallbackAction.instance"/> </file> </folder> </folder>
The mentioned Action has to be a subclass of
org.openide.util.actions.CallbackSystemAction. It does not necessarily has to
perform the action, it's just a placeholder for linking the shortcut. You might want to override it's
getActionMapKey() and give it a
The actual action that does the work in your component (preferably a simple Swing
is to be put into your
ActionMap. The key for the
has to match the key defined in the global action's
getActionMap().put("PreviousViewAction", new MyPreviousTabAction());
This way even actions from multiple
TopComponents with the same gesture (eg. "switch to next tab") can share the same configurable shortcut.
Note: Don't define your action's shortcut and don't put it into any of the
javax.swing.InputMap. Otherwise the component would not pick up the changed shortcut from the
The sources for the module are in the NetBeans Mercurial repositories.
Read more about the implementation in the answers to architecture questions.
Built on September 19 2017. | Portions Copyright 1997-2017 Oracle. All rights reserved.