netbeans拖拽的控件完全无法编辑吗

来源:百度知道 编辑:UC知道 时间:2024/06/25 07:34:11
有没有修改的方法 比如JTREE怎么改

在JTree的属性中选model,可选属性、方法和用户代码。
例如:
1、可在在代码中先加一个方法
private DefaultTreeModel initialTreeMode() {
DefaultMutableTreeNode root=new DefaultMutableTreeNode("公司");
DefaultMutableTreeNode subRoot=new DefaultMutableTreeNode("办公室");
root.add(subRoot);
subRoot=new DefaultMutableTreeNode("技术中心");
root.add(subRoot);
return new DefaultTreeModel(root);
}
2、在model属性中选择这个方法。
这样就可以随心所欲的定制树了。

期待知识份子来回答......