public void paint(Graphics g) { if (! this.getSize().equals(lastSize)) { lastSize = this.getSize(); makeTexture(); // Creates "image", a BufferedImage of appropriate size. this.repaint(); } g.drawImage(image, 0, 0, null); }