기본 NetBeans edito가있는 양식을 만들고 jTree
을 넣습니다. 그런데 어떻게 든 "색", "스포츠", "음식"과 같은 요소들을 무리로 만듭니다. 그러나 그것은 창조 법칙에 포함되어 있지 않습니다. 어디에서 오는 및 어떻게 그것을 편집 할 수 있습니다 ...JTree with form builder
내가 할 경우에도 jTree1.removeAll();
모든 것은 여전히 거기에 ... 및 jTree 작업에 새 항목을 추가하는 내 코드 중.
private void test(java.awt.event.MouseEvent evt) {
//trying to remove all, but it does not remove anything
jTree1.removeAll();
//it does print it in debug meaning that this function is called
System.out.println("qwe");
//create the root node
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
//create the child nodes
DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child 1");
DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child 2");
//add the child nodes to the root node
root.add(child1);
root.add(child2);
//now how do I add it to the tree?
//???
}
나는 런타임에 jTree
내용을 편집 할 수 있어야합니다. 다음에
에 대한 튜토리얼 읽기 'JTree'를 만드는 방법은 무엇입니까? 너는 무엇을하고 싶은지, 명확하지 않다. – alex2410
NetBeans에서 양식 빌더를 사용합니다.이 비주얼 편집기의 양식에 놓았습니다. 나는 그 이상으로 아무것도하지 않았다. – NewProger