Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Canvas


    return "PeersGraphicView.title";
  }

  public void initialize(Composite composite) {
    display = composite.getDisplay();
    panel = new Canvas(composite,SWT.NULL);
  }
View Full Code Here


    splash = new Shell(display, SWT.NO_TRIM);
    splash.setText(Constants.APP_NAME);
    Utils.setShellIcon(splash);

    splash.setLayout(new FillLayout());
    canvas = new Canvas(splash, SWT.DOUBLE_BUFFERED);

    ImageLoader imageLoader = ImageLoader.getInstance();
    background = imageLoader.getImage(IMG_SPLASH);
    if (ImageLoader.isRealImage(background)) {
      width = background.getBounds().width;
View Full Code Here

      new Label( shell, SWT.NULL );
     
    }else{

      final Rectangle spinBounds = spinImages[0].getBounds();
        final Canvas  canvas =
          new Canvas( shell, SWT.NULL )
          {
            public Point computeSize(int wHint, int hHint,boolean changed )
            {
              return( new Point(spinBounds.width, spinBounds.height));
            }
          };
         
          canvas.addPaintListener(new PaintListener() {
            public void paintControl(PaintEvent e) {
              e.gc.drawImage(spinImages[curSpinIndex ], 0, 0);
            }
          });
         
          Utils.execSWTThreadLater(100, new AERunnable() {
            public void runSupport() {
              if (canvas == null || canvas.isDisposed()) {
                return;
              }

              canvas.redraw();
              canvas.update();
              if (curSpinIndex == spinImages.length - 1) {
                curSpinIndex = 0;
              } else {
                curSpinIndex++;
              }
View Full Code Here

      Composite colorSet = new Composite(legend, SWT.NONE);

      colorSet.setLayout(new RowLayout(SWT.HORIZONTAL));

      final Canvas cColor = new Canvas(colorSet, SWT.BORDER);
      cColor.setData("Index", new Integer(i));
      // XXX Use paint instead of setBackgrond, because OSX does translucent
      // crap
      cColor.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
          int i = ((Integer)cColor.getData("Index")).intValue();
          e.gc.setBackground(blockColors[i]);
          e.gc.fillRectangle(e.x, e.y, e.width, e.height);
        }
      });

      cColor.addMouseListener(new MouseAdapter() {
        public void mouseUp(MouseEvent e) {
          Integer iIndex = (Integer)cColor.getData("Index");
          if (iIndex == null)
            return;
          int index = iIndex.intValue();

          if (e.button == 1) {
            ColorDialog cd = new ColorDialog(panel.getShell());
            cd.setRGB(blockColors[index].getRGB());
           
            RGB rgb = cd.open();
            if (rgb != null)
              config.setRGBParameter(keys[index], rgb.red, rgb.green, rgb.blue);
          } else {
            config.removeRGBParameter(keys[index]);
          }
        }
      });

      Label lblDesc = new Label(colorSet, SWT.NULL);
      Messages.setLanguageText(lblDesc, keys[i]);

      data = new RowData();
      data.width = 20;
      data.height = lblDesc.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 3;
      cColor.setLayoutData(data);
     
      // If color changes, update our legend
      config.addParameterListener(keys[i],paramListeners[i] = new ParameterListener() {
        public void parameterChanged(String parameterName) {
          for (int j = 0; j < keys.length; j++) {
            if (keys[j].equals(parameterName)) {
              final int index = j;

              final int r = config.getIntParameter(keys[j] + ".red", -1);
              if (r >= 0) {
                final int g = config.getIntParameter(keys[j] + ".green");
                final int b = config.getIntParameter(keys[j] + ".blue");
               
                final RGB rgb = new RGB(r, g, b);
                if (blockColors[j].isDisposed()
                    || !rgb.equals(blockColors[j].getRGB())) {

                  Utils.execSWTThread(new AERunnable() {
                    public void runSupport() {
                      if (panel == null || panel.isDisposed())
                        return;
                      Color color = ColorCache.getColor(panel.getDisplay(), r, g, b);
                      blockColors[index] = color;
                      cColor.redraw();
                    }
                  });
                }
              } else {
                if (blockColors[j].isDisposed()
                    || !blockColors[j].equals(defaultColors[j])) {
                  Utils.execSWTThread(new AERunnable() {
                    public void runSupport() {
                      if (panel == null || panel.isDisposed())
                        return;
                      blockColors[index] = defaultColors[index];
                      cColor.redraw();
                    }
                  });
                }
              }
            }
View Full Code Here

    Messages.setLanguageText(lbl,"CacheView.speeds.writes");
   
    lbl = new Label(gCacheSpeeds,SWT.NULL);
    Messages.setLanguageText(lbl,"CacheView.speeds.fromCache");
   
    readsFromCache = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    readsFromCache.setLayoutData(gridData);
    rfcGraph = SpeedGraphic.getInstance();
    rfcGraph.initialize(readsFromCache);
   
   
    writesToCache = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    writesToCache.setLayoutData(gridData);
    wtcGraph = SpeedGraphic.getInstance();
    wtcGraph.initialize(writesToCache);
   
    lbl = new Label(gCacheSpeeds,SWT.NULL);
    Messages.setLanguageText(lbl,"CacheView.speeds.fromFile");
   
    readsFromFile = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    readsFromFile.setLayoutData(gridData);
    rffGraph = SpeedGraphic.getInstance();
    rffGraph.initialize(readsFromFile);
   
    writesToFile = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    writesToFile.setLayoutData(gridData);
    wtfGraph = SpeedGraphic.getInstance();
    wtfGraph.initialize(writesToFile);
  }
View Full Code Here

  }

  public void initialize(Composite composite) {
    GridData gridData;

    upSpeedCanvas = new Canvas(composite, SWT.DOUBLE_BUFFERED);
    gridData = new GridData(GridData.FILL_BOTH);
    upSpeedCanvas.setLayoutData(gridData);
    upSpeedGraphic = SpeedGraphic.getInstance();
    upSpeedGraphic.initialize(upSpeedCanvas);
    //upSpeedGraphic.setAutoAlpha(true);
View Full Code Here

  }

  public void initialize(Composite composite) {
    GridData gridData;

    downSpeedCanvas = new Canvas(composite, SWT.DOUBLE_BUFFERED);
    gridData = new GridData(GridData.FILL_BOTH);
    downSpeedCanvas.setLayoutData(gridData);
    downSpeedGraphic = SpeedGraphic.getInstance();
    downSpeedGraphic.initialize(downSpeedCanvas);
    //downSpeedGraphic.setAutoAlpha(true);
View Full Code Here

      createOn = skin.getShell();
    } else {
      createOn = (Composite) parent.getControl();
    }

    canvas = new Canvas(createOn, style);
    canvas.setLayoutData(new FormData(maxSize.x == 0 ? SWT.DEFAULT
        : maxSize.x, maxSize.y));
    canvas.setSize(SWT.DEFAULT, maxSize.y);
    setControl(canvas);
   
View Full Code Here

    Messages.setLanguageText(gDownSpeed,"SpeedView.downloadSpeed.title");
    gridData = new GridData(GridData.FILL_BOTH);
    gDownSpeed.setLayoutData(gridData);   
    gDownSpeed.setLayout(new GridLayout());
   
    downSpeedCanvas = new Canvas(gDownSpeed,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    downSpeedCanvas.setLayoutData(gridData);
    downSpeedGraphic = SpeedGraphic.getInstance();
    downSpeedGraphic.initialize(downSpeedCanvas);
    Color[] colors = downSpeedGraphic.colors;
   
    Group gUpSpeed = new Group(panel,SWT.NULL);
    Messages.setLanguageText(gUpSpeed,"SpeedView.uploadSpeed.title");
    gridData = new GridData(GridData.FILL_BOTH);
    gUpSpeed.setLayoutData(gridData);
    gUpSpeed.setLayout(new GridLayout());
   
    upSpeedCanvas = new Canvas(gUpSpeed,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    upSpeedCanvas.setLayoutData(gridData);
    upSpeedGraphic = SpeedGraphic.getInstance();
    upSpeedGraphic.initialize(upSpeedCanvas);
   
View Full Code Here

    data = new GridData();
    data.horizontalSpan = 3;
    label.setLayoutData(data);
   
   
    in = new Canvas(gTransport,SWT.NO_BACKGROUND);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 3;
    in.setLayoutData(data);
    inGraph = SpeedGraphic.getInstance();
    inGraph.initialize(in);
   
    label = new Label(gTransport,SWT.NONE);
    Messages.setLanguageText(label,"DHTView.transport.out");
    data = new GridData();
    data.horizontalSpan = 3;
    label.setLayoutData(data);
   
    out = new Canvas(gTransport,SWT.NO_BACKGROUND);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 3;
    out.setLayoutData(data);
    outGraph = SpeedGraphic.getInstance();
    outGraph.initialize(out);
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.