I have JScrollPane which contains only one instance of JTree. How can I set margin around JTree inside of JScrollPane?
I have such a code
tree.setPreferredSize(new Dimension(200, 200));
JScrollPane scrollerTree = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollerTree.setPreferredSize(new Dimension(200, 199));
scrollerTree.getVerticalScrollBar().setUnitIncrement(16);
I want to achieve, that margin would be scrollable with scrollpane content.