why this code not works?

Posted by badgirl on Stack Overflow See other posts from Stack Overflow or by badgirl
Published on 2010-03-26T14:24:58Z Indexed on 2010/03/26 14:33 UTC
Read the original article Hit count: 173

Filed under:
|

Hello. I want to create new node of BeanTreeView, and when I add some node in constructor, then run the app, and then I try to view the window with tree, it throws this error

java.lang.AssertionError: Component cannot be created for {component=null, displayName=Exploirer, instanceCreate=AlwaysEnabledAction[Exploirer]}
    at org.openide.windows.OpenComponentAction.getTopComponent(OpenComponentAction.java:71)

Why? And how to add node there? See the code.

private ProjectsChildren projectsChildren;
private ProjectNode projectNode = new ProjectNode(new MainProject("ggg"), projectsChildren);

public ExploirerTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(ExploirerTopComponent.class, "CTL_ExploirerTopComponent"));
    setToolTipText(NbBundle.getMessage(ExploirerTopComponent.class, "HINT_ExploirerTopComponent"));
    //        setIcon(ImageUtilities.loadImage(ICON_PATH, true));
    //map.put("delete", ExplorerUtils.actionDelete(mgr, true));
    associateLookup (ExplorerUtils.createLookup(mgr, getActionMap()));
    //projectsChildren.createProject("demence");

   /* somewhere here is the problem*/
   mgr.setRootContext(projectNode);
   ProjectNode[] pr = null;
   pr[0] = projectNode;
   mgr.getRootContext().getChildren().add(pr);
  }

© Stack Overflow or respective owner

Related posts about java

Related posts about netbeans