An example of how to use ActionListeners.
-------------------------------------------
class LoadAction extends AbstractAction {
LoadAction(){
super("Load"); //this is the menu item name in a popup
}
public void actionPerformed(ActionEvent e){
//do what you want to here
}
---------------
JPopupMenu popup = new JPopupMenu();
popup.add(new LoadAction());
---------------
You can also call the Action explicitly by
new LoadAction().actionPerformed(null);
-----
If you need access to members of the parent class pass them to the LoadAction constructor. when you create it.
--------
edu.upmc.opi.spin.client.SpinDataStoreTreeViewer
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment