Examples of Graphics


Examples of java.awt.Graphics

    paintIconRectangular(painter);
  }
 
  @Override
  public void paintIconRectangular(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    g.setColor(Color.black);
    g.drawRect(1, 2, 16, 16);
    Font old = g.getFont();
    g.setFont(old.deriveFont(9.0f));
    GraphicsUtil.drawCenteredText(g, "2k", 96);
    GraphicsUtil.drawCenteredText(g, "+1", 9, 13);
    g.setFont(old);
  }
View Full Code Here

Examples of java.awt.Graphics

    }
   
    public void draw(InstancePainter painter) {
      KeyboardData data = getKeyboardState(painter);
      Bounds bds = painter.getInstance().getBounds();
      Graphics g = painter.getGraphics();
      FontMetrics fm = g.getFontMetrics(DEFAULT_FONT);

      String str;
      int cursor;
      int dispStart;
      synchronized(data) {
        str = data.toString();
        cursor = data.getCursorPosition();
        if (!data.isDisplayValid()) data.updateDisplay(fm);
        dispStart = data.getDisplayStart();
      }

      int asc = fm.getAscent();
      int x = bds.getX() + 8;
      if (dispStart > 0) {
        x += fm.stringWidth(str.charAt(0) + "m");
        x += fm.stringWidth(str.substring(dispStart, cursor));
      } else if (cursor >= str.length()) {
        x += fm.stringWidth(str);
      } else {
        x += fm.stringWidth(str.substring(0, cursor));
      }
      int y = bds.getY() + (bds.getHeight() + asc) / 2;
      g.drawLine(x, y - asc, x, y);
    }
View Full Code Here

Examples of java.awt.Graphics

    state.setPort(B_OUT, outs[1].not(), delay);
  }

  @Override
  public void paintInstance(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    painter.drawBounds();

    g.setColor(Color.GRAY);
    painter.drawPort(IN0);
    painter.drawPort(IN1);
    painter.drawPort(OUT);
    painter.drawPort(B_IN,  "b in",  Direction.NORTH);
    painter.drawPort(B_OUT, "b out", Direction.SOUTH);

    Location loc = painter.getLocation();
    int x = loc.getX();
    int y = loc.getY();
    GraphicsUtil.switchToWidth(g, 2);
    g.setColor(Color.BLACK);
    g.drawLine(x - 15, y, x - 5, y);
    GraphicsUtil.switchToWidth(g, 1);
  }
View Full Code Here

Examples of java.awt.Graphics

    setIconNames("andGate.gif", "andGateRect.gif", "dinAndGate.gif");
  }

  @Override
  protected void paintIconShaped(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    int[] xp = new int[] { 10, 2, 2, 10 };
    int[] yp = new int[] { 2, 2, 18, 18 };
    g.drawPolyline(xp, yp, 4);
    GraphicsUtil.drawCenteredArc(g, 10, 10, 8, -90, 180);
  }
View Full Code Here

Examples of java.awt.Graphics

    if (columns == 0) {
      setPreferredSize(new Dimension(0, 0));
      return;
    }
   
    Graphics g = getGraphics();
    if (g == null) {
      cellHeight = 16;
      cellWidth = 24;
    } else {
      FontMetrics fm = g.getFontMetrics(HEAD_FONT);
      cellHeight = fm.getHeight();
      cellWidth = 24;
      for (int i = 0; i < columns; i++) {
        String header = sel.get(i).toShortString();
        cellWidth = Math.max(cellWidth, fm.stringWidth(header));
View Full Code Here

Examples of java.awt.Graphics

    state.setPort(C_OUT, outs[1], delay);
  }

  @Override
  public void paintInstance(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    painter.drawBounds();

    g.setColor(Color.GRAY);
    painter.drawPort(IN0);
    painter.drawPort(IN1);
    painter.drawPort(OUT);
    painter.drawPort(C_IN,  "c in",  Direction.NORTH);
    painter.drawPort(C_OUT, "c out", Direction.SOUTH);

    Location loc = painter.getLocation();
    int x = loc.getX();
    int y = loc.getY();
    GraphicsUtil.switchToWidth(g, 2);
    g.setColor(Color.BLACK);
    g.drawLine(x - 15, y - 5, x - 5, y + 5);
    g.drawLine(x - 15, y + 5, x - 5, y - 5);
    GraphicsUtil.switchToWidth(g, 1);
  }
View Full Code Here

Examples of java.awt.Graphics

    setPaintInputLines(true);
  }

  @Override
  public void paintIconShaped(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    GraphicsUtil.drawCenteredArc(g, 0,   -5, 22, -9053);
    GraphicsUtil.drawCenteredArc(g, 0,   23, 2290, -53);
    GraphicsUtil.drawCenteredArc(g, -129, 16, -3060);
  }
View Full Code Here

Examples of javax.microedition.lcdui.Graphics

  public void draw(Graphics aGraphic, int aX, int aY, boolean aBody,
      boolean aScrollBar) {
    //#ifdef DLOGGING
//@    if (finestLoggable) {logger.finest("draw aX,aY,width,height,aBody,aScrollBar=" + aX + "," + aY + "," + width + "," + height + "," + aBody + "," + aScrollBar);}
    //#endif
    Graphics g = offscreen.getGraphics();
    // Draw background
    g.setColor(background);
    if (aBody) {
      g.fillRect(0, 0, width, height);
    }
    // Draw text
    g.setColor(foreground);
    drawText(g);
    if (aBody) {
      // Draw border
      g.setColor(foreground);
      g.drawRect(0, 0, width - 1, height - 1);
      if (aScrollBar) {
        // Draw scroll
        g.setColor(background);
        g.fillRect(width - scrollWidth, 0, scrollWidth - 1, height - 1);
        g.setColor(foreground);
        g.drawRect(width - scrollWidth, 0, scrollWidth - 1, height - 1);
        int scroll = getScrollPosition(height, scrollHeight);
        g.fillRect(width - scrollWidth, scroll,
            scrollWidth - 1, scrollHeight - 1);
      }
    }
    // Draw offscreen
    aGraphic.drawImage(offscreen, aX, aY, Graphics.LEFT | Graphics.TOP);
View Full Code Here

Examples of net.rim.device.api.ui.Graphics

              int scaleY = Fixed32.div( Fixed32.toFP( backgroundImage.getHeight() ), Fixed32.toFP( Display.getHeight() ) );
              EncodedImage scaledBgImage = backgroundImage.scaleImage32(scaleX, scaleY);

              // Using the scaled bg image draw onto the blank white bitmap.
              Bitmap bgImg = new Bitmap( scaledBgImage.getScaledWidth(), scaledBgImage.getScaledHeight() );
                Graphics g = new Graphics( bgImg );
                if( bgColor != -1 ) {
                  g.setColor( bgColor );
                } else {
                  g.setColor( Color.WHITE );
                }
                g.fillRect( 0, 0, scaledBgImage.getScaledWidth(), scaledBgImage.getScaledHeight() );
                g.drawImage( 0, 0, scaledBgImage.getScaledWidth(), scaledBgImage.getScaledHeight(),
                    scaledBgImage, 0, 0, 0 );

                Background bg = BackgroundFactory.createBitmapBackground( bgImg,
                        Background.POSITION_X_CENTER, Background.POSITION_Y_CENTER, Background.REPEAT_SCALE_TO_FIT );
                this.setBackground( bg );
View Full Code Here

Examples of org.eclipse.draw2d.Graphics

      Image image = new Image(Display.getCurrent(), bounds.width,
          bounds.height);

      // Paints the figure on it using SWT graphics
      GC gc = new GC(image);
      Graphics swtGraphics = new SWTGraphics(gc);
      paintFigure(shape, backgroundColor, bounds, swtGraphics);

      // Draws the image on the original graphics
      graphics.drawImage(image, 0, 0);

      // Disposes image (and GC btw) and SWT graphics
      image.dispose();
      swtGraphics.dispose();
    }
  }
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.