SliceNode (TreePath path) { Object lastPathComponent = path.getLastPathComponent(); if (lastPathComponent instanceof DefaultMutableTreeNode node) { Object userObject = node.getUserObject(); if (userObject instanceof SliceNode) { return (SliceNode)userObject; } } return null; }