JSidePane提供了一个Java滑动面板控件.
// create and configure a JSidePane component
JSidePane sidePane = new JSidePane();
sidePane.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// add a tree with a "tree" title
sidePane.addGroup(new JTree(), new ValueAction("tree"));
// add a list with a empty title
sidePane.addGroup(new JList());
// add a tree with a "dir" title
sidePane.addGroup(new JTree(), new ValueAction("dir"));
// add a tree with a "file" title
sidePane.addGroup(new JTree(), new ValueAction("file"));
JSidePane支持单选和多选模式.
// create and configure a JSidePane component
JSidePane sidePane = new JSidePane();
// sets the single selection mode
sidePane.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// sets the multiple selection mode
sidePane.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);