/** Convenience method to remove the desktopIcon of <b>f</b> is necessary. */ protected void removeIconFor(JInternalFrame f) { JInternalFrame.JDesktopIcon di = f.getDesktopIcon(); Container c = di.getParent(); if (c != null) { c.remove(di); c.repaint(di.getX(), di.getY(), di.getWidth(), di.getHeight()); } }