void (Component c, Graphics g, int x, int y) { if (isEmpty()) { return; } Dimension size = getPreferredSize(); setSize(size); Graphics2D g2 = (Graphics2D)g.create(x, y, size.width, size.height); paint(g2); g2.dispose(); }