svoid truncateContainer(Container c, int n) swing { if (c != null) while (c.getComponentCount() > n) c.remove(c.getComponentCount()-1); }