Posted By

laurenceosx on 02/13/13


Tagged

swing groovy


Versions (?)

groovy close a JFrame window the same way as when the user clicks on the X close window button


 / Published in: Groovy
 

close a JFrame window the same way as when the user clicks on the X close window button

  1. def closeWindow( aWindow ) {
  2. // e.g. close a JFrame window the same way as when the user clicks on the X close window button.
  3. java.awt.event.WindowEvent wev = new java.awt.event.WindowEvent(aWindow, java.awt.event.WindowEvent.WINDOW_CLOSING);
  4. java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
  5. }

Report this snippet  

You need to login to post a comment.