public void paint(Graphics g)
{
        Image imgBuffer = this.createImage(this.getWidth(),this.getHeight());
        Graphics gimg=imgBuffer.getGraphics();
gimg.drawString("test",10,10);
gimg.dispose();
g.drawImage(imgBuffer,0,0,null);