selection disabled in the tree view

This commit is contained in:
hneemann 2017-05-26 07:33:04 +02:00
parent f7c82e4893
commit 30c3d44ab4

View File

@ -37,10 +37,11 @@ public class SelectTree extends JTree {
public SelectTree(LibraryTreeModel model, CircuitComponent component, ShapeFactory shapeFactory, InsertHistory insertHistory) {
super(model);
this.shapeFactory = shapeFactory;
setSelectionModel(null);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent mouseEvent) {
TreePath path = getSelectionPath();
public void mousePressed(MouseEvent mouseEvent) {
TreePath path = getClosestPathForLocation(mouseEvent.getX(), mouseEvent.getY());
if (path != null && path.getPathCount() > 0) {
LibraryNode node = (LibraryNode) path.getLastPathComponent();
if (node.isLeaf() && node.isUnique()) {