Examples of Canvas


Examples of org.eclipse.swt.widgets.Canvas

    return false;
  }

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

Examples of org.eclipse.swt.widgets.Canvas

    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

Examples of org.openoffice.accessibility.awb.canvas.Canvas

            );
        aLeftViewSplitPane.setDividerLocation (300);
        aLeftViewSplitPane.setContinuousLayout (true);

        //  Canvas.
        maCanvas = new Canvas ();
        maCanvas.SetTree (maTree);
        JScrollPane aScrolledCanvas = new JScrollPane(maCanvas,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        aScrolledCanvas.getViewport().setBackground (java.awt.Color.RED);
View Full Code Here

Examples of org.rendersnake.interfaces.Canvas

import junit.framework.TestCase;

public class InterfacesTest extends TestCase {

  public void test(){
    Canvas canvas = new Canvas();
    canvas
      .html()
        .body()
          .write("Hi")
          .div()
            .write("Hello")
View Full Code Here

Examples of org.rsbot.client.input.Canvas

    releaseMouse(x, y, true);
  }

  @SuppressWarnings("unused")
  private void gainFocus() {
    final Canvas cw = getCanvasWrapper();
    if (!cw.hasFocus()) {
      cw.setFocused(true);
    }
  }
View Full Code Here

Examples of org.sikuli.api.visual.Canvas

     
      ScreenRegion screenRegion = new DesktopScreenRegion(screenId);
      ScreenRegion innerRegion = Relative.to(screenRegion).shorter(100).narrower(100).getScreenRegion();

      // create a canvas to draw visualization on the screen
      Canvas c = new ScreenRegionCanvas(screenRegion);
      c.addBox(innerRegion);
      c.addLabel(innerRegion.getCenter(), "Screen " + screenId).withFontSize(30);
      c.addImage(Relative.to(innerRegion).center().above(200).getScreenLocation(), ImageIO.read(Images.Dog));
      c.show();
     
      // hover the mouse cursor to each corner of the inner circle
      mouse.hover(Relative.to(innerRegion).topLeft().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).topRight().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).bottomRight().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).bottomLeft().getScreenLocation());
     
      // find the dog and click on it
      ScreenRegion dog = innerRegion.find(new ImageTarget(Images.Dog));
      mouse.click(dog.getCenter());
     
      c.hide();
    }
   
 
  }
View Full Code Here

Examples of org.tomighty.ui.util.Canvas

      return cache.get(iconName);
    }

    Dimension size = tray.iconSize();
    Colors colors = look.colors();
    Canvas canvas = new Canvas(size);
    canvas.fontSize((float) size.height * 0.58f);
    canvas.paintGradient(colors.background());
    canvas.drawBorder(colors.background().darker().darker().darker());
    canvas.drawCentralizedText(time.shortestString());

    cache.store(canvas.image(), iconName);

    return canvas.image();
  }
View Full Code Here

Examples of org.zkoss.canvas.Canvas

  private Listbox shapeListBox;
 
  public void onClick$deleteBtn(Event event){
    Window canvasBoardWindow = (Window) zkpaintWindow
      .getFellow("canvasInc").getFellow("canvasBoardWindow");
    Canvas cvs1 = (Canvas) canvasBoardWindow.getFellow("cvs1");
    int size = shapeListBox.getItemCount();
    System.out.println(size);
    for(int i=size-1; i>-1; i--){
      if(!shapeListBox.getItemAtIndex(i).isSelected()) continue;
      System.out.println(i);
      cvs1.remove(i);
      ((ListModelList) shapeListBox.getModel()).remove(i);
    }
  }
View Full Code Here

Examples of pivot.wtk.media.drawing.Canvas

    };

    private DrawingListenerList drawingListeners = new DrawingListenerList();

    public Drawing() {
        this(new Canvas());
    }
View Full Code Here

Examples of playn.core.Canvas

    }

    protected Icon createSampler (int baseColor) {
        int size = 16;
        CanvasImage cimg = graphics().createImage(size * 17, size);
        Canvas canvas = cimg.canvas();
        int lighter = baseColor;
        for (int ii = 0; ii <= 8; ++ii) {
            canvas.setFillColor(lighter);
            canvas.fillRect(size * (ii + 8), 0, size, size);
            lighter = Colors.brighter(lighter);
        }
        int darker = baseColor;
        for (int ii = 0; ii < 8; ++ii) {
            canvas.setFillColor(darker);
            canvas.fillRect(size * (7 - ii), 0, size, size);
            darker = Colors.darker(darker);
        }

        canvas.setStrokeColor(Colors.BLACK);
        canvas.strokeRect(size * 8, 0, size - 1, size - 1);
        return Icons.image(cimg);
    }
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.