MyInspectionTreeNode () { TreePath selectedPath = myInspectionsTable.getTree().getPathForRow(myInspectionsTable.getSelectedRow()); return selectedPath != null ? (MyInspectionTreeNode)selectedPath.getLastPathComponent() : null; }