开发者

How to add JTree dynamically to a created JScrollPane?

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜