Exemplo n.º 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);
  }
Exemplo n.º 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); // 画输入图        	
   }
 }
Exemplo n.º 3
0
 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);
     }
           
 }
Exemplo n.º 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);
  }
Exemplo n.º 5
0
 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);
   }
 }
Exemplo n.º 6
0
 public void update(Graphics g) {
   if (img == null) g.clearRect(0, 0, getSize().width, getSize().height);
   paintComponent(g);
 }