/* KeyPressClosure.java */ import java.awt.*; import java.awt.event.*; import groovy.lang.Closure; /** * An KeyListener that executes a Groovy closure. * The closure can take the KeyEvent as an argument. */ public class KeyPressClosure extends KeyAdapter { public KeyPressClosure( Closure c ) { _c = c; } public void keyPressed( KeyEvent evt ) { _c.call(evt); } private Closure _c; }