I know how to add a tree inside JScrollpane. Some thing like this
JScrollPane treePane = new JScrollPane(tree);
treePane.setBorder(null);
tree.setPreferredSize(null);
treePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
holder.add(treePane);// holder is a JPanel
This makes the entire tree scrollable. I want only the node items to be scrollable. I have a cutsom cell renderer written . That returns a specific JPanel for each leaf node.
So i want to know is it possible to display only the nodes inside a JScrollPane?? Here is the screenshot of my current tree.