static JInternalFrame centerInternalFrame(JInternalFrame f) { Container c = f.getParent(); if (c != null) f.setLocation((c.getWidth()-f.getWidth())/2, (c.getHeight()-f.getHeight())/2); ret f; }