@Override public void mouseClicked(MouseEvent e) { if (e.getSource() == filesTable) { if (e.getClickCount() == 2 && e.getModifiersEx() == 0) { // the modifiers test is to prevent absurd clicks like "b1, b3" registering as // double-clicks. if (filesTable.getSelectedRow() >= 0) { FileSystemEntry clicked = fs.getEntryForRow(filesTable.convertRowIndexToModel(filesTable.getSelectedRow())); if (clicked.isDirectory()) { // Go into the directory: TreePath pathToClicked = clicked.getPath(); browseTree.setSelectionPath(pathToClicked); browseTree.scrollPathToVisible(pathToClicked); browseTree.setSelectionPath( pathToClicked); // the first one may have expanded the node and changed the // selection, so ensure the node we want is actually selected. } else { downloadToDirectory(Arrays.asList(new FileSystemEntry[] {clicked}), null, null); frame.setStatusHint( new StatusHint( frame.gui.util.getImage("tick"), clicked.getName() + " queued for download!")); } } } } if (e.getSource() == browseTree) { // remove a search if they clicked on the searches icon. if (lastOnIcon && lastInspectedFSE instanceof FileSystemEntry && ((FileSystemEntry) lastInspectedFSE).isSearch()) { fs.removeSearch((FileSystemEntry) lastInspectedFSE); lastInspectedFSE = null; // doesn't exist anymore. lastOnIcon = false; mouseMoved( new MouseEvent( browseTree, 0, System.currentTimeMillis(), 0, e.getX(), e.getY(), 0, false)); // simulate the mouse moving to update status bar and icons. } // remove all searches if the clicked the searchroot: if (lastInspectedFSE == fs.getSearchRoot()) { fs.removeAllSearches(); } } }