示例#1
0
  /** Overrides <code>Graphics.clearRect</code>. */
  public void clearRect(int x, int y, int width, int height) {
    DebugGraphicsInfo info = info();

    if (debugLog()) {
      info().log(toShortString() + " Clearing rect: " + new Rectangle(x, y, width, height));
    }

    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.clearRect(x, y, width, height);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.clearRect(x, y, width, height);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.clearRect(x, y, width, height);
  }
示例#2
0
 public void paint(Graphics g) {
   if (loadflag && (!runflag)) {
     g.clearRect(0, 0, 530, 330);
     Graphics2D g2D = (Graphics2D) g;
     g2D.translate(0, 50); // 设置图像左上角为当前点
     g.drawImage(iImage, 0, 0, null); // 画输入图        	
   }
 }
示例#3
0
文件: Gray.java 项目: zqyhellen/graph
 public void paint(Graphics g) 
 {    	  
     if (iImage != null)
     {
     	g.clearRect(0, 0, 260, 350);        	
         g.drawImage(iImage, 5, 50, null);
         g.drawString("pic1", 120, 320);
     }
           
 }
示例#4
0
  public void paintComponent(Graphics frontBuffer) {
    // Clear the back buffer
    backBuffer.clearRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());

    // Draw all objects to the back buffer in order from back-to-front
    paintBackground();
    paintEntities();

    // Draw the back buffer onto the front buffer all at once to avoid flickering from repeated draw
    // commands
    frontBuffer.drawImage(backBufferImage, this.getX(), this.getY(), this);
  }
 public void paintComponent(Graphics g) { // display
   if (isFirst) {
     myWidth = getWidth();
     myHeight = getHeight();
     define();
     isFirst = false;
   }
   g.clearRect(0, 0, getWidth(), getHeight());
   room.draw(g); // draw map
   store.draw(g); // draw sidebar
   // b.draw(g);
   theMinion.draw(g);
   if (to != null) { // tower selected movement
     to.draw(g, xval, yval, to);
   }
   for (Tower i : tplace) {
     i.draw(g, i);
   }
 }
示例#6
0
文件: LJ3MDApp.java 项目: eskilj/mvp
 public void update(Graphics g) {
   if (img == null) g.clearRect(0, 0, getSize().width, getSize().height);
   paintComponent(g);
 }