Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Canvas


        lbAccessType = new Label(preference, SWT.READ_ONLY);
        lbAccessType.setText("Visualizing: ");
        visualizing = new List(preference, SWT.READ_ONLY);
        visualizing.setItems(new String[] {"Read" , "Write"});
        visualizing.setSelection(0);
        c = new Canvas(topshell, SWT.DOUBLE_BUFFERED | SWT.BORDER);
        c.setLayoutData(new RowData(topshell.getClientArea().width,
                topshell.getClientArea().height - 75));
        c.addPaintListener(this);
        value = new float[noOfBins];
        for (int i = 0; i < noOfBins; i++) {
View Full Code Here


     * @param parent the parent of the Pattern view.
     */
    public final void createPartControl(final Composite parent) {
        cm = new ColorMap(parent.getDisplay());
        this.topshell = parent;
        c = new Canvas(parent, SWT.BORDER | SWT.DOUBLE_BUFFERED);
        c.addPaintListener(new PaintListener()
        {
            public void paintControl(final PaintEvent e) {
                paintLabel(e.gc);
            }
        });
        c2 = new Canvas(parent, SWT.BORDER | SWT.DOUBLE_BUFFERED);
        c2.addPaintListener(new PaintListener()
        {
            public void paintControl(final PaintEvent e) {
                paintPattern(e.gc);
            }
View Full Code Here

        details = new Composite(preference, SWT.BORDER);
        details.setLayout(new FillLayout());
        lbDetails = new Label(details, SWT.NONE);
        lbDetails.setText("Details: N/A");
        preference.pack();
        c = new Canvas(topshell, SWT.DOUBLE_BUFFERED | SWT.BORDER);
        c.setLayoutData(new RowData(topshell.getClientArea().width,
                topshell.getClientArea().height - 150));
        c.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK));
        c.addPaintListener(this);
        c.addMouseMoveListener(this);
View Full Code Here

        lbAccessType = new Label(preference, SWT.READ_ONLY);
        lbAccessType.setText("Visualizing: ");
        visualizing = new List(preference, SWT.READ_ONLY);
        visualizing.setItems(new String[] {"Read" , "Write"});
        visualizing.setSelection(0);
        c = new Canvas(topshell, SWT.DOUBLE_BUFFERED | SWT.BORDER);
        c.setLayoutData(new RowData(topshell.getClientArea().width,
                topshell.getClientArea().height - 75));
        c.addPaintListener(this);
        value = new float[noOfBins];
        for (int i = 0; i < noOfBins; i++) {
View Full Code Here

     * @param parent the parent of the Pattern view.
     */
    public final void createPartControl(final Composite parent) {
        cm = new ColorMap(parent.getDisplay());
        this.topshell = parent;
        c = new Canvas(parent, SWT.BORDER | SWT.DOUBLE_BUFFERED);
        c.addPaintListener(new PaintListener()
        {
            public void paintControl(final PaintEvent e) {
                paintLabel(e.gc);
            }
        });
        c2 = new Canvas(parent, SWT.BORDER | SWT.DOUBLE_BUFFERED);
        c2.addPaintListener(new PaintListener()
        {
            public void paintControl(final PaintEvent e) {
                paintPattern(e.gc);
            }
View Full Code Here

            @Override
            public void run() {
                final int ms = 1000 / 50;
                final Display display = new Display();
                final Shell shell = new Shell(display, SWT.SHELL_TRIM & ~SWT.RESIZE);
                final Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
                canvas.addPaintListener(Viz.this);
                canvas.setSize(512, 512);
                shell.setText("MDS");
                shell.pack();
                shell.open();
                display.timerExec(ms , new Runnable() {
                    @Override
                    public void run() {
                        if (shell.isDisposed()) return;
                        canvas.redraw();
                        display.timerExec(ms, this);
                    }
                });
                while (!shell.isDisposed()) {
                    if (!display.readAndDispatch())
View Full Code Here

            @Override
            public void run() {
                final int ms = 1000 / 50;
                final Display display = new Display();
                final Shell shell = new Shell(display, SWT.SHELL_TRIM & ~SWT.RESIZE);
                final Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
                canvas.addPaintListener(PointsDatavis.this);
                canvas.setSize(512, 512);
                shell.setText("MDS");
                shell.pack();
                shell.open();
                display.timerExec(ms , new Runnable() {
                    @Override
                    public void run() {
                        if (shell.isDisposed()) return;
                        canvas.redraw();
                        display.timerExec(ms, this);
                    }
                });
                while (!shell.isDisposed()) {
                    if (!display.readAndDispatch())
View Full Code Here

        mapContainer.setLayout(new FillLayout(SWT.LEFT));
        mapContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
       
        updateBackgroundColors();

        canvas = new Canvas(mapContainer, SWT.DOUBLE_BUFFERED);
        hoverShell = new HoverShell(canvas);
        MenuManager menuMgr= new MenuManager();
        menuMgr.setRemoveAllWhenShown(true);
        menuMgr.addMenuListener(menuListener);
        Menu menu = menuMgr.createContextMenu(canvas);
View Full Code Here

    return false;
  }

  @Override
  public void createPartControl(Composite parent) {
    canvas = new Canvas(parent, SWT.NONE);
  }
View Full Code Here

    final ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
    itemRefresh.setText(getResourceString("Refresh"));
    final ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
    itemGo.setText(getResourceString("Go"));
    location = new Text(parent, SWT.BORDER);
    final Canvas canvas = new Canvas(parent, SWT.NO_BACKGROUND);
    final Rectangle rect = images[0].getBounds();
    canvas.addListener(SWT.Paint, new Listener() {
      public void handleEvent(Event e) {
        Point pt = canvas.getSize();
        e.gc.drawImage(images[index], 0, 0, rect.width, rect.height, 0, 0,
            pt.x, pt.y);
      }
    });
    canvas.addListener(SWT.MouseDown, new Listener() {
      public void handleEvent(Event e) {
        browser.setUrl(getResourceString("Startup"));
      }
    });
    display.asyncExec(new Runnable() {
      public void run() {
        if (canvas.isDisposed())
          return;
        if (busy) {
          index++;
          if (index == images.length)
            index = 0;
          canvas.redraw();
        }
        display.timerExec(150, this);
      }
    });
    final Label status = new Label(parent, SWT.NONE);
    final ProgressBar progressBar = new ProgressBar(parent, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 5);
    toolbar.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(canvas, 5, SWT.DEFAULT);
    data.bottom = new FormAttachment(status, -5, SWT.DEFAULT);
    try {
      browser = new Browser(parent, SWT.NONE);
      browser.setLayoutData(data);
    } catch (SWTError e) {
      /* Browser widget could not be instantiated */
      Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
      label.setText(getResourceString("BrowserNotCreated"));
      label.setLayoutData(data);
    }
    data = new FormData();
    data.width = 24;
    data.height = 24;
    data.top = new FormAttachment(0, 5);
    data.right = new FormAttachment(100, -5);
    canvas.setLayoutData(data);
    data = new FormData();
    data.top = new FormAttachment(toolbar, 0, SWT.TOP);
    data.left = new FormAttachment(toolbar, 5, SWT.RIGHT);
    data.right = new FormAttachment(canvas, -5, SWT.DEFAULT);
    location.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(0, 5);
    data.right = new FormAttachment(progressBar, 0, SWT.DEFAULT);
    data.bottom = new FormAttachment(100, -5);
    status.setLayoutData(data);
    data = new FormData();
    data.right = new FormAttachment(100, -5);
    data.bottom = new FormAttachment(100, -5);
    progressBar.setLayoutData(data);
    if (browser != null) {
      itemBack.setEnabled(browser.isBackEnabled());
      itemForward.setEnabled(browser.isForwardEnabled());
      Listener listener = new Listener() {
        public void handleEvent(Event event) {
          ToolItem item = (ToolItem) event.widget;
          if (item == itemBack)
            browser.back();
          else if (item == itemForward)
            browser.forward();
          else if (item == itemStop)
            browser.stop();
          else if (item == itemRefresh)
            browser.refresh();
          else if (item == itemGo)
            browser.setUrl(location.getText());
        }
      };
      browser.addLocationListener(new LocationListener() {
        public void changed(LocationEvent event) {
          busy = true;
          if (event.top)
            location.setText(event.location);
        }
        public void changing(LocationEvent event) {
        }
      });
      browser.addProgressListener(new ProgressListener() {
        public void changed(ProgressEvent event) {
          if (event.total == 0)
            return;
          int ratio = event.current * 100 / event.total;
          progressBar.setSelection(ratio);
          busy = event.current != event.total;
          if (!busy) {
            index = 0;
            canvas.redraw();
          }
        }
        public void completed(ProgressEvent event) {
          itemBack.setEnabled(browser.isBackEnabled());
          itemForward.setEnabled(browser.isForwardEnabled());
          progressBar.setSelection(0);
          busy = false;
          index = 0;
          canvas.redraw();
        }
      });
      browser.addStatusTextListener(new StatusTextListener() {
        public void changed(StatusTextEvent event) {
          status.setText(event.text);
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Canvas

Copyright © 2018 www.massapicom. 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.