I am currently trying to build an expanding panel in Swing (akin the WPF's Expander
control) and I'd like to retain the usual methods for manipulating it (i. e. setLayout
, add
, etc.). Only they should be routed to an embedded panel (the one being shown or hidden).
How would one do that? Overriding every method of JComponent
and re-routing that to an embedded JPanel
would be cumbersome, but that's the only way I see.
Or should I rather make the embedded panel visible to the outside and force users to use something like ExpanderPanel.getInnerPanel()
instead. But then it's no drop-in replacement for JPanel
which I think would be nice to have.