// c = JComponent or something implementing swing() static JComponent wrap(O swingable) { JComponent c = cast swingable instanceof JComponent ? swingable : callOpt(swingable, "swing"); if (c instanceof JTable || c instanceof JList || c instanceof JTextArea || c instanceof JEditorPane || c instanceof JTextPane) ret new JScrollPane(c); ret c; }