public void mouseReleased(MouseEvent mouseEvent) {
        if (treePane.getDragRectangle() != null) {
            Set<Node> selectedNodes = treePane.getNodesAt((Graphics2D) treePane.getGraphics(), treePane.getDragRectangle().getBounds());

            if (!mouseEvent.isShiftDown()) {
                treePane.clearSelection();
            }

            SelectionMode mode = selectionMode;
            if (mouseEvent.isAltDown()) {
                if (mode == SelectionMode.NODE) {
                    mode = SelectionMode.CLADE;
                } else if (mode == SelectionMode.CLADE) {
                    mode = SelectionMode.NODE;
                }
            }

            for (Node selectedNode : selectedNodes) {
                switch (mode) {
                    case NODE:
                        treePane.addSelectedNode(selectedNode, true);
                        break;
                    case CLADE:
                        treePane.addSelectedClade(new Node[]{selectedNode, null}, true);
                        break;
                    case TAXA:
                        treePane.addSelectedTaxa(selectedNode);
                        break;
                    default:
                        throw new IllegalArgumentException("Unknown SelectionMode: " + selectionMode.name());
                }
            }
        }
        treePane.setDragRectangle(null);
    }