Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.GC.drawRectangle()


    GC gc = new GC(image);
    Rectangle bounds = image.getBounds();
    gc.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    gc.fillRectangle(0, 0, bounds.width, bounds.height);
    gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
    gc.drawRectangle(0, 0, bounds.width - 1, bounds.height - 1);
    FontData data[] = font.getFontData();
    int style = data[0].getStyle();
    switch (style) {
    case SWT.NORMAL:
      gc.drawLine(3, 3, 3, 8);
View Full Code Here


          gc.setBackground(color);
          gc.fillRectangle(e.x, e.y, e.width, e.height);
        }
        Point size = canvas.getSize();
        gc.drawArc(cx + 1, cy + 1, size.x - 2, size.y - 2, 0, 360);
        gc.drawRectangle(cx + (size.x - 10) / 2, cy + (size.y - 10) / 2, 10, 10);
        Point extent = gc.textExtent(CanvasTab.canvasString);
        gc.drawString(CanvasTab.canvasString, cx + (size.x - extent.x) / 2, cy - extent.y + (size.y - 10) / 2,
            true);
      }
    });
View Full Code Here

    shell.addPaintListener(new PaintListener() {
      public void paintControl(PaintEvent event) {
        GC gc = event.gc;
        gc.setForeground(red);
        Rectangle rect = shell.getClientArea();
        gc.drawRectangle(rect.x + 10, rect.y + 10, rect.width - 20, rect.height - 20);
        gc.drawString(HelloWorld5.resHello.getString("Hello_world"), rect.x + 20, rect.y + 20);
      }
    });
    shell.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
View Full Code Here

        Display display = fButton.getDisplay();

        GC gc = new GC(fImage);
        gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
        gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);

        if (fColor != null)
            fColor.dispose();

        fColor = new Color(display, fColorValue);
View Full Code Here

                                gc2.setAlpha(255);
                                gc2.drawRectangle(Math.round(rect[0]), Math.round(rect[1]), Math.round(rect[2]),
                                        Math.round(rect[3]));

                                gc2.setForeground(black);
                                gc2.drawRectangle(0, 0, size.x, size.y);
                            } finally {
                                gc2.dispose();
                            }
                            lastImage = image;
                        }
View Full Code Here

                                gc2.setLineWidth(3);
                                gc2.setAlpha(150);
                                gc2.fillRectangle(Math.round(rect[0]), Math.round(rect[1]), Math.round(rect[2]),
                                        Math.round(rect[3]));
                                gc2.setAlpha(255);
                                gc2.drawRectangle(Math.round(rect[0]), Math.round(rect[1]), Math.round(rect[2]),
                                        Math.round(rect[3]));

                                gc2.setForeground(black);
                                gc2.drawRectangle(0, 0, size.x, size.y);
                            } finally {
View Full Code Here

            }

            // Draw the selection
            if (selection != null) {
                gc.setForeground(selectionColor);
                gc.drawRectangle(
                        selection.x * twidth, selection.y * height,
                        (selection.width + 1) * twidth,
                        (selection.height + 1) * height);
                gc.setBackground(selectionColor);
                gc.setAlpha(SELECTION_ALPHA);
View Full Code Here

    if (bg != null)
      gc.setBackground(bg);
    if (isPlain()) {
      Point size = container.getSize();
      gc.fillRectangle(0, 0, size.x, size.y);
      gc.drawRectangle(0, 0, size.x - 1, size.y - 1);
    } else {
      switch (location) {
      case SWT.LEFT:
        paintLeft(gc);
        break;
View Full Code Here

        if (!inactiveBorder
            && (c instanceof Text || c instanceof CCombo || textBorder)) {
          Rectangle b = c.getBounds();
          GC gc = event.gc;
          gc.setForeground(c.getBackground());
          gc.drawRectangle(b.x - 1, b.y - 1, b.width + 1,
              b.height + 1);
          // gc.setForeground(getBorderStyle() == SWT.BORDER ? colors
          // .getBorderColor() : colors.getForeground());
          gc.setForeground(colors.getBorderColor());
          if (c instanceof CCombo)
View Full Code Here

              b.height + 1);
          // gc.setForeground(getBorderStyle() == SWT.BORDER ? colors
          // .getBorderColor() : colors.getForeground());
          gc.setForeground(colors.getBorderColor());
          if (c instanceof CCombo)
            gc.drawRectangle(b.x - 1, b.y - 1, b.width + 1,
                b.height + 1);
          else
            gc.drawRectangle(b.x - 1, b.y - 2, b.width + 1,
                b.height + 3);
        } else if (inactiveBorder || c instanceof Table
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.