if (s instanceof Plot) { Plot p = (Plot) s; if (p.getID() != null) { k++; if (s instanceof Plot) { Plot p = (Plot) s; if (p.getID() != null) { g2d.setColor(p.getColor()); g2d.fillRect(x, y, width, height); g2d.drawRect(x, y, width, height); g2d.drawString(p.getID(), x + 2 * width, y + height); y += 2 * width;