static void setFrameOrWindowContents(Component c, JComponent contents) { var w = getWindow(c); if (w cast JWindow) setWindowContents(w, contents); else if (w cast JFrame) setFrameContents(w, contents); }