JCollapsiblePane 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.
In this example, the JCollapsiblePane is used to build
a Search pane which can be shown and hidden on demand.
JCollapsiblePane cp = new JCollapsiblePane();
// JCollapsiblePane can be used like any other container
cp.setLayout(new BorderLayout());
// the Controls panel with a textfield to filter the tree
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);
JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
// Put the "Controls" first
frame.add("North", cp);
// Then the tree - we assume the Controls would somehow filter the tree
JScrollPane scroll = new JScrollPane(new JTree());
frame.add("Center", scroll);
// Show/hide the "Controls"
JButton toggle = new JButton(cp.getActionMap().get(JCollapsiblePane.TOGGLE_ACTION));
toggle.setText("Show/Hide Search Panel");
frame.add("South", toggle);
frame.pack();
frame.setVisible(true);
JTaskPane provides an elegant view
to display a list of tasks ordered by groups (
JTaskPane .
Although
JTaskPaneGroup can be added to any other
container, the JTaskPane will provide better
fidelity when it comes to matching the look and feel of the host operating
system than any other panel.