org.gnu.gtk.event

Interface LifeCycleListener

public interface LifeCycleListener

This is the listener interface for receiving life cycle realted events for a Widget.

An example of using this class to manage the life cycle events of an application would be as follows:

  public class MyExample {
  
      public static void main( String[] argv ) {
          Gtk.init( argv );
          MyExample example = new MyExample();
          Gtk.main();
      }
  
      public MyExample() {
          Window window = new Window( WindowType.TOPLEVEL );
          window.setTitle( "AboutDialogExample" );
  	   window.addListener( new Life() );
          window.showAll();
      }
  <strong>
      protected class Life implements LifeCycleListener {
          public void lifeCycleEvent(LifeCycleEvent event) {}
          public boolean lifeCycleQuery(LifeCycleEvent event) {
              if (event.isOfType(LifeCycleEvent.Type.DESTROY) || 
                  event.isOfType(LifeCycleEvent.Type.DELETE)) {
                  Gtk.mainQuit();
              }
              return false;
          }
      }
  </strong>
  }
  
 
See Also:
LifeCycleEvent

Method Summary

void
lifeCycleEvent(LifeCycleEvent event)
This method is for all void-returning LifeCycleEvents (ie everything not of type LifeCycleEvent.Type.DESTROY or LifeCycleEvent.Type.DELETE.
boolean
lifeCycleQuery(LifeCycleEvent event)
This method is for the delete and destroy events.

Method Details

lifeCycleEvent

public void lifeCycleEvent(LifeCycleEvent event)
This method is for all void-returning LifeCycleEvents (ie everything not of type LifeCycleEvent.Type.DESTROY or LifeCycleEvent.Type.DELETE.

TODO: document this properly.


lifeCycleQuery

public boolean lifeCycleQuery(LifeCycleEvent event)
This method is for the delete and destroy events.

TODO: document this properly.