Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个用作模型的JTree对象,DefaultTreeModel我添加/删除该模型的节点。
JTree
DefaultTreeModel
此时,我需要在图形界面中显示树结构,例如JPanel. 如何将DefaultTreeModel元素映射到Jpanel对象?换句话说,我怎样才能将JTree对象绘制成JPanel对象。由于可以修改树,因此实施应反映更改。
JPanel
Jpanel
谢谢你的照顾。
就像是:
JPanel p = new JPanel(new BorderLayout()); JScrollPane sp = new JScrollPane(jtree); p.add(BorderLayout.CENTER, sp);