I’m writing a Java Desktop App using NetBeans 6.5 and a Swing Patterns that keeps repeating. Each and every one of my dialogs has a Save Button and Close Button with mostly different behavior behind the Save Button and identical code behind the close button.
How can I reuse this code without copying and pasting and at the same time retain the user of GUI Builder tools for the Inner panel of the dialog box?
I’m not a netbeans expert, but I’d suggest add a saveAction and closeAction to the dialog box constructor both of which implement Action, and then just get the GUI builder code to execute the appropriate Action.