Once in the open source project Openswing saw a similar QQ folding panel components, I found that Windows inside the task panel and that function somewhat similar, openswing code on a slightly more complex, so decided to write a hand, nonsense do not say first to see the effect of the comparison chart:
Windows Task window:
My simulation effect:
Oh, there are some kind of spirit, the following to say a few key points:
1. First to determine the overall structure: is a large panel nested n sub Panels
2. To determine the subpanel structure, first the header of the child panel to always display, the content panel (with children) can be hidden, so we use the BorderLayout layout subpanel, introduced jbuider verticalflowlayout layout content Panel, When you show or hide the panel, all the components on the RemoveAll () Subpanel are added again.
3. The last is the sub-Panel title button, the Content item label implementation, are inherited basic jcomponent