不要用repaint(),动态画矩形时可先把原位置的矩形异或掉,再在新位置画新矩形

解决方案 »

  1.   

    你是為了消除閃爍??
    試一下BufferedImage
      

  2.   

    to 第一位兄弟:矩形画是没有问题,只是每次mousemove的时候会调用repaint 所以没办法的to 第二位兄弟:repaint已经是override的了,但是仍旧不能够解决to 第三位兄弟:bufferimage如何使用? 有无代码?
      

  3.   

    BufferedImage frameImage;
    Graphics imageGraphics;
    Graphics graphics;//得到屏幕大小放入framImage
    frameImage = (BufferedImage) createImage(this.getSize().width,this.getSize().height);
    imageGraphics = frameImage.getGraphics();
    graphics = getGraphics();paint(imageGraphics);graphics.drawImage(frameImage, 0, 0, null);
      

  4.   

    用swing 组件做,采用jpanel面板,本声就带有双缓冲功能。