Set the Row Height of a JTree in Java
Description
The following code shows how to set the Row Height of a JTree.
Example
/*from w w w .j av a 2s . co m*/
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
public class Main {
public static void main(String[] argv) {
JTree tree = new JTree();
tree.setRowHeight(30);
JFrame frame = new JFrame("tree row height");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new JScrollPane(tree));
frame.setSize(380, 320);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Swing »
Java Tutorial »
Swing »