2011-02-08 1 views
0

약간의 혼동이 있습니다. 함수 insertNodeInto는 하위 노드가 아닌 단일 노드 만 삽입하는 데 사용됩니까? 예를 들어 나는 다음과 같은 코드를 가지고 :model.insertNodeInto() 함수의 작업

DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("topMost"); 
newNode.add(new DefaultMutableTreeNode("A node")); 
newNode.add(new DefaultMutableTreeNode("B node")); 
model.insertNodeInto(newNode,rootNode,0); 

그래서 위의 코드 트리 또는 맨 위의 노드에 모든 3 개 노드를 추가 할 것인가?

+1

시험해보고 결과를 알려주세요. – camickr

+0

네, 실제로 모든 자식 노드를 삽입합니다. –

답변

2

노드가 모든 자식과 함께 간단한 테스트에서 보여 지듯이 모델에 삽입됩니다.

관련 문제