static void removeFromConsole3(Component c) { JFrame frame = getFrame(c); if (frame == null) ret; Container cp = frame.getContentPane(); // This is our BorderLayout Container cp2 = (Container) getCenterComponent(cp); Container cp3 = (Container) getCenterComponent(cp2); if (cp3 != c.getParent()) { print("removeFromConsole3 fail"); ret; } cp3.remove(c); // free our component Container mainC = (Container) cp3.getComponents()[0]; cp3.remove(mainC); replaceCenterComponent(cp2, mainC); validateFrame(frame); }