MY Jtree component is created within a actionperformed function. But I've already created a Jscrollpane in the constructor and added it to the JFrame.
Now within the actionperformed function, I tried to add the dynamically created JTree开发者_StackOverflow社区 to the JScrollpane using
JScrollpaneobject.add(JtreeObject);
JScrollpaneobject.revalidate();
But I am unable to see the Jtree on the Jscrollpane.
direct variant of the same:
scroll.setViewportView(jTree)
scroll.getViewport().add(jTree)
精彩评论