tree = new LibraryTree();
tree.setRootNode(library.getRootNode());
JScrollPane scrollPane = new JScrollPane(tree);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
add(scrollPane, BorderLayout.CENTER);
final SearchField searchField = new SearchField();
Box viewBox = Box.createHorizontalBox();
JComboBox viewCombo = new JComboBox(new Object[]{"By Album Artist"});
JPanel p1 = new JPanel(new BorderLayout());
p1.add(viewCombo);
p1.setMaximumSize(new Dimension(200, 100));
p1.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "View",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.TOP, new Font("Sans Serif", 0, 11)));
viewBox.add(p1);
JPanel p2 = new JPanel(new BorderLayout());
p2.add(searchField);
p2.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "Filter",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.TOP, new Font("Sans Serif", 0, 11)));
viewBox.add(p2);
add(viewBox, BorderLayout.PAGE_END);
searchField.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (searchWorker != null && !searchWorker.isDone()) {
searchWorker.cancel(true);
}
searchWorker = new SearchWorker(library.getData(), searchField.getText(), true) {
@Override
protected void done() {
try {
Playlist result = get();
if (result != null) {