Skip to main content

Geertjan Wielenga: Region-Specific CutAction

The CutAction, and other global Actions, can be shared between multiple TopComponents. Depending on what needs cutting, an Action together with the "cut-to-clipboard" key is added to the ActionMap of any TopComponent that needs to integrate with the CutAction. But what about if you have different regions within a single TopComponent? Each region should have the CutAction delegate to a region-specific CutAction. Here's how to do that, with two simple JPanels representing two regions in the TopComponent...