JTree的setRoot()时ClassNotLoadedException

时间:2015-03-05 19:13:03

标签: java debugging jtree

当我尝试将ClassNotLoadedException设置为JTree的根时,我有一个treeModel.setRoot(treeNode)

我的代码:

public static DefaultMutableTreeNode parse(JTree tree, JScrollPane scrollPane, TreeCellRenderer renderer, mySAXParser SAXParser, String newXML) {
    DefaultMutableTreeNode treeNode;
    mySAXParser parser = SAXParser;
    treeNode = parser.getTreeNode();
    tree.setCellRenderer(renderer);

    DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel();
    treeModel.setRoot(treeNode);
    TreeSelectionModel treeSelectionModel = tree.getSelectionModel();
    treeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    tree.setSelectionModel(treeSelectionModel);
    scrollPane.setEnabled(true);
    expandTree(tree);

    return treeNode;
}

初​​始化:

myTree = new JTree();
((DefaultTreeModel) myTree.getModel()).setRoot(null);
scrollPane= new JScrollPane(myTree);

完整的异常消息:

org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.

我不明白为什么会这样,有人能帮助我理解吗?

0 个答案:

没有答案