dialog components wobble when details pane shown or hidden
I'm trying to create a dialog which has a hideable details pane, something
(This is not an image of my dialog, just an example.)
On the face of it, replicating this should be trivial. However, I've been
struggling with a layout problem for several days now. When the user clicks
the details button and the details scroll pane is hidden, the dialog should
make itself taller in order to accommodate the details scroll pane; when the
user clicks the details button and the scroll pane is visible, the scroll pane
should disappear and the dialog should contract back to the height it would
have without the scroll pane showing.
The important point here is that toggling the visibility of the details
scroll pane should have no effect at all on the size or position of the
components above it---the Details button should not wobble as you click it on
or off---nor should the visibility of the details scroll pane affect the size
of components appearing below it, if there are any.
Secondly, if I manually adjust the height of the dialog, then the "expanded"
and "collapsed" heights of the dialog should also change. E.g., if I have the
details pane open, then resize the dialog to make it taller (which adds some
extra height to the part of the dialog which is always visible), and finally
close the details pane, the height which the dialog should return to is not the
old "collapsed" height, but rather the height needed to display the
still-visible components after the resize.
This sounds simple, but I don't see how to accomplish this with any of the
standard layouts. Every standard layout I've tried cause the always-visible
components to wobble when I toggle the visibility of the details pane. I've
tried writing a custom layout manager, and I've been able to get that to
behave properly for situations where it's the outermost layout inside the
dialog, but I haven't been able to get it to work when it's nested inside
Does anyone have an idea of how I should approach this? I'll post the code for
my custom layout if anyone wants to see it, but I suspect that there must be a
much better solution to this problem than writing a custom layout.