static Component getFrameContents(JFrame f) { Container cp = f.getContentPane(); if (cp.getLayout() instanceof BorderLayout && countComponents(cp) == 1) { Component c = getCenterComponent(cp); if (c != null) ret c; } ret cp; }