static JInternalFrame centerInternalFrame(final JInternalFrame f) { swing { Container c = f.getParent(); if (c != null) { //print("Container type: " + className(c) + ", bounds: " + c.getBounds()); f.setLocation((c.getWidth()-f.getWidth())/2, (c.getHeight()-f.getHeight())/2); } } ret f; } static JInternalFrame centerInternalFrame(final int w, final int h, final JInternalFrame f) { swing { f.setSize(w, h); } ret centerInternalFrame(f); }