Object prev = null; TreePath current = null;  if (node != null) prev = getPreviousNode(node);  if (prev != null) { current = new TreePath(getPathToRoot(prev, 0)); if (tree.isVisible(current)) return prev;  while (prev != null && !tree.isVisible(current))
if (currentVisiblePath != null)
  Object getPreviousVisibleNode(Object node)  {    Object prev = null;    TreePath current = null;    if (node != null)      prev = getPreviousNode(node);    if (prev != null)      {        current = new TreePath(getPathToRoot(prev, 0));        if (tree.isVisible(current))          return prev;        while (prev != null && !tree.isVisible(current))          {            prev = getPreviousNode(prev);            if (prev != null)              current = new TreePath(getPathToRoot(prev, 0));          }      }    return prev;  }