import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class WidgetDisposeListener {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
System.out.println(e.widget + " disposed");
}
});
shell.setSize(260, 120);
shell.open();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
}