extends ControlAdapter : ControlAdapter « org.eclipse.swt.events « Java by API






extends ControlAdapter


import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class MainClass {

  public static void main(String[] a) {
    Display display = new Display();

    // Create the main window
    Shell shell = new Shell(display);

    shell.addControlListener(new ControlAdapter() {
      public void controlResized(ControlEvent event) {
        // Get the event source (the shell)
        Shell shell = (Shell) event.getSource();
        Rectangle rect = shell.getClientArea();
        System.out.println(rect);
      }
    });
    
    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}

           
       








Related examples in the same category