Here you can find the source of expandPathOnEdt(final JTree tree, final TreePath path)
public static void expandPathOnEdt(final JTree tree, final TreePath path)
//package com.java2s; //License from project: Open Source License import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.tree.TreePath; public class Main { public static void expandPathOnEdt(final JTree tree, final TreePath path) { SwingUtilities.invokeLater(new Runnable() { public void run() { tree.expandPath(path);//from w w w .java 2s .c o m } }); } }