public void paint(Graphics g){
  g=g.create();
  setRenderingHints(g);
  setCompositeOnGraphics((Graphics2D)g);
  super.paint(g);
}

public void paint ( Graphics g ) { g = g . create ( ) ; setRenderingHints ( g ) ; setCompositeOnGraphics ( ( Graphics2D ) g ) ; super . paint ( g ) ; }
if you are going to change the graphics object in this method , you should make a copy of it first using the graphics . create ( ) method so the changes won ' t affect other layers .
