public void paint(Graphics g) { synchronized (this) { Graphics2D g2d = (Graphics2D) g; if (img != null) { int imgw = img.getWidth(); int imgh = img.getHeight(); g2d.setComposite(AlphaComposite.Src); g2d.drawImage(img, null, 0, 0); } } }