public void paintComponent(Graphics g) {
	        if (image == null) {
	          image = createImage(getSize().width, getSize().height);
	          graphics2D = (Graphics2D) image.getGraphics();
	          graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
	              RenderingHints.VALUE_ANTIALIAS_ON);
	          graphics2D.setPaint(Color.white);
	          
	          graphics2D.fillRect(0, 0, getSize().width, getSize().height);
	          graphics2D.setPaint(Color.black);
	          repaint();
	        }
	  
	        g.drawImage(image, 0, 0, null);
	   }