We would like to know how to automatically resize a JTree.
import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTree; //from w w w.j a v a 2 s.c o m public class Main { public static void main(String[] args) { JTree tree = new JTree(); tree.setVisibleRowCount(10); JOptionPane.showMessageDialog(null, new JScrollPane(tree)); } }