Scripting Java with Javascript: trapping Swing events