JXCollapsiblePane provides a component which can collapse or
expand its content area with animation and fade in/fade out effects.
It also acts as a standard container for other Swing components.
// to add a child
collapsiblePane.getContentPane().add(component);
// to add a child
collapsiblePane.add(component);
-------------------------------
JXCollapsiblePane cp = new JXCollapsiblePane();
cp.setLayout(new BorderLayout());
JPanel controls = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 0));
controls.add(new JLabel("Search:"));
controls.add(new JTextField(10));
controls.add(new JButton("Refresh"));
controls.setBorder(new TitledBorder("Filters"));
cp.add("Center", controls);
JXFrame frame = new JXFrame();
frame.setLayout(new BorderLayout());
frame.add("North", cp);
Note: JXCollapsiblePane requires its parent container to have a
LayoutManager using getPreferredSize() when
calculating its layout (example VerticalLayout,
BorderLayout).