Package java.awt

Examples of java.awt.Graphics


    paintBase(painter);
  }
 
  @Override
  public void paintInstance(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    g.setColor(Color.BLACK);
    paintBase(painter);
    painter.drawPorts();
    painter.drawLabel();
  }
View Full Code Here


    state.setPort(OUT, vy, delay);
  }
 
  @Override
  public void paintInstance(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    painter.drawBounds();

    painter.drawPorts();

    Location loc = painter.getLocation();
    int x = loc.getX() - 15;
    int y = loc.getY();
    Object shift = painter.getAttributeValue(ATTR_SHIFT);
    g.setColor(Color.BLACK);
    if (shift == SHIFT_LOGICAL_RIGHT) {
      g.fillRect(x, y - 1, 8, 3);
      drawArrow(g, x + 10, y, -4);
    } else if (shift == SHIFT_ARITHMETIC_RIGHT) {
      g.fillRect(x, y - 1, 2, 3);
      g.fillRect(x + 3, y - 1, 5, 3);
      drawArrow(g, x + 10, y, -4);
    } else if (shift == SHIFT_ROLL_RIGHT) {
      g.fillRect(x, y - 1, 5, 3);
      g.fillRect(x + 8, y - 7, 2, 8);
      g.fillRect(x, y - 7, 2, 8);
      g.fillRect(x, y - 7, 10, 2);
      drawArrow(g, x + 8, y, -4);
    } else if (shift == SHIFT_ROLL_LEFT) {
      g.fillRect(x + 6, y - 1, 4, 3);
      g.fillRect(x + 8, y - 7, 2, 8);
      g.fillRect(x, y - 7, 2, 8);
      g.fillRect(x, y - 7, 10, 2);
      drawArrow(g, x + 3, y, 4);
    } else { // SHIFT_LOGICAL_LEFT
      g.fillRect(x + 2, y - 1, 8, 3);
      drawArrow(g, x, y, 4);
    }
  }
View Full Code Here

  public void paint(InstancePainter painter) {
    Bounds bds = painter.getBounds();
    BitWidth width = painter.getAttributeValue(StdAttr.WIDTH);
    int len = (width.getWidth() + 3) / 4;

    Graphics g = painter.getGraphics();
    g.setColor(Color.RED);
    int wid = 7 * len + 2; // width of caret rectangle
    int ht = 16; // height of caret rectangle
    g.drawRect(bds.getX() + (bds.getWidth() - wid) / 2,
        bds.getY() + (bds.getHeight() - ht) / 2, wid, ht);
    g.setColor(Color.BLACK);
  }
View Full Code Here

    protected void doRender(RenderingContext c, Layer root) {
        try {
            // paint the normal swing background first
            // but only if we aren't printing.
            Graphics g = ((Java2DOutputDevice)c.getOutputDevice()).getGraphics();           
            paintDefaultBackground(g);
   
            long start = System.currentTimeMillis();
            if (!c.isPrint()) {
                root.paint(c);
View Full Code Here

          String text = node.getNodeFormatter().format((ProgramItem)node.getUserObject());

          // use an image to be able to display HTML content on the node
          BufferedImage textImage = getImage(bounds);
          Graphics lg = textImage.getGraphics();

          mProgramLabel.setFont(tree.getFont());
          mProgramLabel.setForeground(g.getColor());
          mProgramLabel.setBackground(UIManager.getColor("Tree.background"));
          mProgramLabel.setText(text);
          mProgramLabel.setOpaque(true);
          mProgramLabel.setBounds(0, 0, bounds.width, bounds.height);
          mProgramLabel.paint(lg);

          g.drawImage(textImage, bounds.x, bounds.y, mProgramLabel);
          lg.dispose();
        }
        else {
          super.paintRow(g,clipBounds,insets,bounds,path,row,isExpanded,hasBeenExpanded,isLeaf);
        }
      }
View Full Code Here

    if (value == null)
    {
      return;
    }

    final Graphics graphics = gfx.create();
    graphics.setColor(value);
    graphics.fillRect(box.x, box.y, box.width, box.height);
    graphics.setColor(Color.BLACK);
    graphics.drawRect(box.x, box.y, box.width, box.height);
    graphics.dispose();
  }
View Full Code Here

        imageUpdate(progressbar, ImageObserver.FRAMEBITS, 0, 0, 0, 0);
      }
    }

    // draw everything onto an image before drawing to avoid flicker
    Graphics og = offscreen.getGraphics();
    FontMetrics fm = og.getFontMetrics();

    // clear background color
    og.setColor(bgColor);
    og.fillRect(0, 0, offscreen.getWidth(null), offscreen.getHeight(null));

    og.setColor(fgColor);
    String message = getDescriptionForState();

    // if we had a failure of some sort, notify the user
    if (fatalError) {
      String[] errorMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage;

      for(int i=0; i<errorMessage.length; i++) {
        if(errorMessage[i] != null) {
          int messageX = (offscreen.getWidth(null) - fm.stringWidth(errorMessage[i])) / 2;
          int messageY = (offscreen.getHeight(null) - (fm.getHeight() * errorMessage.length)) / 2;

          og.drawString(errorMessage[i], messageX, messageY + i*fm.getHeight());
        }
      }
    } else {
      og.setColor(fgColor);

      painting = true;

      // get position at the middle of the offscreen buffer
      int x = offscreen.getWidth(null)/2;
      int y = offscreen.getHeight(null)/2;

      // draw logo
      if (logo != null) {
        og.drawImage(logoBuffer, x-logo.getWidth(null)/2, y-logo.getHeight(null)/2, this);
      }

      // draw message
      int messageX = (offscreen.getWidth(null) - fm.stringWidth(message)) / 2;
      int messageY = y + 20;

      if (logo != null) messageY += logo.getHeight(null)/2;
      else if (progressbar != null) messageY += progressbar.getHeight(null)/2;

      og.drawString(message, messageX, messageY);

      // draw subtaskmessage, if any
      if(subtaskMessage.length() > 0) {
        messageX = (offscreen.getWidth(null) - fm.stringWidth(subtaskMessage)) / 2;
        og.drawString(subtaskMessage, messageX, messageY+20);
      }

      // draw loading bar, clipping it depending on percentage done
      if (progressbar != null) {
        int barSize = (progressbar.getWidth(null) * percentage) / 100;
        og.clipRect(x-progressbar.getWidth(null)/2, 0, barSize, offscreen.getHeight(null));
        og.drawImage(progressbarBuffer, x-progressbar.getWidth(null)/2, y-progressbar.getHeight(null)/2, this);
      }

      painting = false;
    }

    og.dispose();

    // finally draw it all centred
    g.drawImage(offscreen, (getWidth() - offscreen.getWidth(null))/2, (getHeight() - offscreen.getHeight(null))/2, null);
  }
View Full Code Here

      // select which buffer to fill
      if (img == logo) buffer = logoBuffer;
      else buffer = progressbarBuffer;

      Graphics g = buffer.getGraphics();

      // clear background on buffer
      g.setColor(bgColor);
      g.fillRect(0, 0, buffer.getWidth(null), buffer.getHeight(null));

      // buffer background is cleared, so draw logo under progressbar
      if (img == progressbar && logo != null) {
        g.drawImage(logoBuffer, progressbar.getWidth(null)/2-logo.getWidth(null)/2,
                    progressbar.getHeight(null)/2-logo.getHeight(null)/2, null);
      }

      g.drawImage(img, 0, 0, this);
      g.dispose();

      repaint();
    }

    return true;
View Full Code Here

   * Always call this function after you have changed the console
   * buffer. This causes a repaint of the modified rows
   */
  public void refresh() {
    if (bufferImage != null) {
      Graphics g = bufferImage.getGraphics();

      g.setColor(getBackground());
      if (dirty)
        g.fillRect(0, 0, width, height);

      buffer.paintBuffer(g);

      dirty = false;
      repaint();
View Full Code Here

            raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,texWidth,texHeight,3,null);
            texImage = new BufferedImage(glColorModel,raster,false,new Hashtable());
        }

        // copy the source image into the produced image
        Graphics g = texImage.getGraphics();
        g.setColor(new Color(0f,0f,0f,0f));
        g.fillRect(0,0,texWidth,texHeight);
        g.drawImage(bufferedImage,0,0,null);

        // build a byte buffer from the temporary image
        // that be used by OpenGL to produce a texture.
        byte[] data = ((DataBufferByte) texImage.getRaster().getDataBuffer()).getData();
View Full Code Here

TOP

Related Classes of java.awt.Graphics

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.