Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Canvas


        int x = display.getBounds().width;
        int y = display.getBounds().height;
        shell.setBounds(x/4, y/4, GRAPH_WIDTH, GRAPH_HEIGHT);
        shell.setLayout(new FillLayout());
       
        final Canvas canvas = new Canvas(shell, SWT.NONE);
        long currentValue = Long.parseLong(data.getValue().toString());
        long mValue = getGraphMaxValue(currentValue);
        canvas.setData(MAX_VALUE, mValue);
        canvas.setData(GRAPH_VALUES, new long[] {0,0,0,0,0,currentValue});
       
        canvas.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
        canvas.addPaintListener(new PaintListener()
            {
                public void paintControl(PaintEvent event)
                {
                    Canvas canvas = (Canvas)event.widget;
                    int maxX = canvas.getSize().x;
                    int maxY = canvas.getSize().y;
                    event.gc.fillRectangle(canvas.getBounds());
                    event.gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
                    event.gc.setLineWidth(4);
                   
                    Object canvasData = canvas.getData(MAX_VALUE);
                    String str = canvasData.toString();
                    long maxValue = Long.parseLong(str);
                    // Set the graph dimensions
                    event.gc.drawText("0", startX - 40, maxY - startY - 10);
                    event.gc.drawText("" + maxValue/2, startX - 40, maxY/2);
                    event.gc.drawText("" + maxValue, startX - 40, startY);
                   
                    // horizontal line
                    event.gc.drawLine(startX, maxY - startY, maxX - 60, maxY - startY);
                    // vertical line
                    event.gc.drawLine(startX, maxY - startY, startX, startY);
                    // set graph text
                    event.gc.drawText(data.getName(), startX - 40, startY - 40);
                    event.gc.drawText("25 sec", startX, maxY - startY + 10);
                    event.gc.drawText("20 sec", startX + GRAPH_ITEM_GAP, maxY - startY + 10);
                    event.gc.drawText("15 sec", startX + GRAPH_ITEM_GAP * 2, maxY - startY + 10);
                    event.gc.drawText("10 sec", startX + GRAPH_ITEM_GAP * 3, maxY - startY + 10);
                    event.gc.drawText(" 5 sec", startX + GRAPH_ITEM_GAP * 4, maxY - startY + 10);
                    event.gc.drawText(" 0 sec", startX + GRAPH_ITEM_GAP * 5, maxY - startY + 10);
                   
                    // plot the graph now for values
                    event.gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
                    canvasData = canvas.getData(GRAPH_VALUES);
                    long[] graphValues = (long[]) canvasData;
                    for (int i = 0; i < graphValues.length; i++)
                    {
                        int x = startX + i * GRAPH_ITEM_GAP;
                        int yTotalLength = (maxY - 2 * startY);
 
View Full Code Here


     */
    private void createTablePage () {
        Composite parent = getContainer();

        // XXX move all the creation into its own component
        Canvas canvas = new Canvas(parent, SWT.None);

        GridLayout layout = new GridLayout(6, false);
        canvas.setLayout(layout);

        // create the header part with the search function and Add/Delete rows
        Label searchLabel = new Label(canvas, SWT.NONE);
        searchLabel.setText("Filter: ");
        final Text searchText = new Text(canvas, SWT.BORDER | SWT.SEARCH);
View Full Code Here

    Label label = new Label(shell, SWT.NONE);
    label.setText("Categories");
    label.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, false));
   
    new Label(shell, SWT.NONE).setText("Photo:");
    dogPhoto = new Canvas(shell, SWT.BORDER);
    gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    gridData.widthHint = 80;
    gridData.heightHint = 80;
    gridData.verticalSpan = 3;
    dogPhoto.setLayoutData(gridData);
View Full Code Here

    fd.top = new FormAttachment(0, 0);
    textNamePart.setLayoutData(fd);
    textNamePart.addModifyListener(this);

    // Darstellung eines Images.
    canvasImage = new Canvas(inner, 0);
    fd = new FormData();
    fd.top = new FormAttachment(textNamePart, 5, SWT.BOTTOM);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(buttonUse, -5, SWT.TOP);
    fd.left = new FormAttachment(100, -97);
View Full Code Here

    buttonUse.addSelectionListener(this);
    buttonUse.setEnabled(true);
    buttonUse.addMouseWheelListener(this);

    // Darstellung eines Images.
    canvasImage = new Canvas(inner, 0);
    fd = new FormData();
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(buttonUse, -5, SWT.TOP);
    fd.left = new FormAttachment(0, 0);
View Full Code Here

    ifcLayout.marginHeight = ifcLayout.marginWidth = 0;
    inputFieldsComposite = new Composite(shell, 0);
    inputFieldsComposite.setLayout(ifcLayout);

    // Darstellung der Images.
    canvasImage = new Canvas(inputFieldsComposite, SWT.V_SCROLL);
    canvasImage.addPaintListener(this);
    canvasImage.addMouseListener(this);
    ScrollBar vBar = canvasImage.getVerticalBar();
    vBar.addSelectionListener(this);
    int vBarWidth = vBar.getSize().x;
View Full Code Here

            .getStatusLineManager();
  }

  public Caret getCaret() {
    if (_caret == null) {
      Canvas parentCanvas = (Canvas) getControl();
      if (parentCanvas == null || parentCanvas.isDisposed()) {
        return null;
      }

      _caret = new Caret(parentCanvas, 0);
      _caretUpdater.connectViewer();
View Full Code Here

        // TODO Auto-generated method stub
       
      }
    });
   
    canvas = new Canvas(parent, SWT.NONE);
   
    canvas.addPaintListener(new PaintListener()
      {
      @Override
      public void paintControl(PaintEvent e)
View Full Code Here

        createStatusBar(parent);
        createActionBar();
    }

    private void createCanvas(Composite parent) {
        canvas = new Canvas(parent, SWT.EMBEDDED);
        GridData align = new GridData(SWT.FILL, SWT.FILL, true, true);
        canvas.setLayoutData(align);

        canvas.addListener(SWT.Resize, new Listener() {
View Full Code Here

            titleLabel.pack();
            titleSize = titleLabel.getSize();

            final Image titleImage = shell.getImage();
            if (titleImageLabel == null && shell.getImage() != null) {
                titleImageLabel = new Canvas(shell, SWT.NONE);
                titleImageLabel.setBackground(shell.getBackground());
                titleImageLabel.setBounds(titleImage.getBounds());
                titleImageLabel.addListener(SWT.Paint, new Listener() {
                    public void handleEvent(Event event) {
                        event.gc.drawImage(titleImage, 0, 0);
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.