Optimization : Setting Component within JScrollPane
posted 14 years ago
In my application, on different selections over tree control, I give different display to the right of split pane. Display to the right is added within JScrollPane. For every change in selection within a tree control, in method valueChanged having TreeSelectionEvent, I instantiate JScrollPane with Component to be displayed,as a parameter to JScrollPane constructor. My problem is, for an optimization I want to avoid instantiating object of JScrollPane, with change in selection of Tree Node. I havent found any method called, scrollPaneObject.setComponent(myComponent); As well scrollPaneObject.setViewportView(myComponent); doesnt serve my objective, since it merely adds as a child view over existing view. Can anyone help me out, in eliminating instantiating scrollPaneObject, with change in tree selection ?