1 46 package groovy.swing.impl; 47 48 import groovy.lang.Closure; 49 50 import java.awt.event.ActionEvent ; 51 52 import javax.swing.AbstractAction ; 53 54 60 public class DefaultAction extends AbstractAction { 61 62 private Closure closure; 63 64 public void actionPerformed(ActionEvent event) { 65 if (closure == null) { 66 throw new NullPointerException ("No closure has been configured for this Action"); 67 } 68 closure.call(event); 69 } 70 71 public Closure getClosure() { 72 return closure; 73 } 74 75 public void setClosure(Closure closure) { 76 this.closure = closure; 77 } 78 79 } 80 | Popular Tags |