Here you can find the source of checkNode(TreePath path)
private static String checkNode(TreePath path)
//package com.java2s; //License from project: Open Source License import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; public class Main { private static String REMOVE_OPEN_FLOW = "REMOVE_OPEN_FLOW"; private static String ADD_FOLDER_NEW_FLOW = "ADD_FOLDER_NEW_FLOW"; private static String ADD_FOLDER_NEW_FLOW_REMOVE = "ADD_FOLDER_NEW_FLOW_REMOVE"; private static String checkNode(TreePath path) { String type = ""; if (null != path) { TreePath parentPath = path.getParentPath(); DefaultMutableTreeNode currNode = (DefaultMutableTreeNode) path .getLastPathComponent(); DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) parentPath .getLastPathComponent(); if (("My Flows".equals(currNode.getUserObject()) || "Company Flows" .equals(currNode.getUserObject())) && parentNode.isRoot()) { type = ADD_FOLDER_NEW_FLOW; } else if (((String) currNode.getUserObject()) .endsWith(".rm4es")) { type = REMOVE_OPEN_FLOW; } else { type = ADD_FOLDER_NEW_FLOW_REMOVE; }/*w w w . jav a 2s. c o m*/ } return type; } }