static void removeFromParent(Component c) { Container cc = c.getParent(); if (cc != null) cc.remove(c); }