Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Shell.addListener()


                    text.selectAll();
                }
                hasFocus = true;
                Shell shell = getShell();
                shell.removeListener(SWT.Deactivate, listener);
                shell.addListener(SWT.Deactivate, listener);
                Display display = getDisplay();
                display.removeFilter(SWT.FocusIn, focusFilter);
                display.addFilter(SWT.FocusIn, focusFilter);
                Event e = new Event();
                notifyListeners(SWT.FocusIn, e);
View Full Code Here


      @Override
      public void widgetDefaultSelected(SelectionEvent e) {}
    });

    shell.addListener(SWT.Close, new org.eclipse.swt.widgets.Listener() {
      @Override
      public void handleEvent(@Nullable org.eclipse.swt.widgets.Event event) {
        for (final DemoRunner dr : demoRunners) {
          dr.setRunning(false);
        }
View Full Code Here

    final Rectangle rect = image.getBounds();
    GC gc = new GC(image);
    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
    gc.fillOval(rect.x, rect.y, rect.width, rect.height);
    gc.dispose();
    shell.addListener(SWT.Paint, new Listener() {
      @Override
      public void handleEvent(Event event) {
        GC gc = event.gc;
        Transform tr = new Transform(display);
        tr.translate(50, 120);
View Full Code Here

    final ToolBar toolBar = new ToolBar(shell, SWT.WRAP);
    for (int i = 0; i < 12; i++) {
      ToolItem item = new ToolItem(toolBar, SWT.PUSH);
      item.setText("Item " + i);
    }
    shell.addListener(SWT.Resize, new Listener() {
      @Override
      public void handleEvent(Event e) {
        Rectangle rect = shell.getClientArea();
        Point size = toolBar.computeSize(rect.width, SWT.DEFAULT);
        toolBar.setSize(size);
View Full Code Here

  public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);

    shell.addListener(SWT.Paint, new Listener() {
      @Override
      public void handleEvent(Event event) {
        GC gc = event.gc;

        gc.setLineAttributes(new LineAttributes(10, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_SOLID, null, 0, 10));
View Full Code Here

            }
          }
        }, Simulator.SimulatorEventType.STOPPED);
      }

      shell.addListener(SWT.Close, new org.eclipse.swt.widgets.Listener() {
        @SuppressWarnings("synthetic-access")
        @Override
        public void handleEvent(@Nullable org.eclipse.swt.widgets.Event event) {
          simulator.stop();
          while (simulator.isPlaying()) {
View Full Code Here

            if (hasFocus) return;
            if (getEditable ()) text.selectAll ();
            hasFocus = true;
            Shell shell = getShell ();
            shell.removeListener (SWT.Deactivate, listener);
            shell.addListener (SWT.Deactivate, listener);
            Display display = getDisplay ();
            display.removeFilter (SWT.FocusIn, filter);
            display.addFilter (SWT.FocusIn, filter);
            Event e = new Event ();
            notifyListeners (SWT.FocusIn, e);
View Full Code Here

      } else {
        control.getShell().addListener( SWT.Resize, this );
      }
    } else {
      Shell activeShell = widget.getDisplay().getShells()[ 0 ];
      activeShell.addListener( SWT.Resize, this );
    }
  }

  @Override
  public void handleEvent( Event event ) {
View Full Code Here

        control.addListener(SWT.MouseDown, this);
        control.addListener(SWT.Dispose, this);
        control.addListener(SWT.FocusOut, this);
        // Listeners on the target control's shell
        Shell controlShell = control.getShell();
        controlShell.addListener(SWT.Move, this);
        controlShell.addListener(SWT.Resize, this);

      }

      // Remove installed listeners
View Full Code Here

        control.addListener(SWT.Dispose, this);
        control.addListener(SWT.FocusOut, this);
        // Listeners on the target control's shell
        Shell controlShell = control.getShell();
        controlShell.addListener(SWT.Move, this);
        controlShell.addListener(SWT.Resize, this);

      }

      // Remove installed listeners
      void removeListeners() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.