World's Simplest NetBeans Node Implementation

While looking into some small corners of the Nodes API, I realized that this is probably the simplest Nodes implementation. It is perfect for demos and presentations and trainings, etc. Anyone can code this and it is easy to explain what's going on:
class SystemPropertyNode extends Children.Keys {

    protected void addNotify() {
        Properties props = System.getProperties();

    protected Node[] createNodes(String key) {
        return new Node[]{new PropNode(key)};

    private class PropNode extends AbstractNode {
        private PropNode(String key) {
            super(Children.LEAF, Lookups.fixed());


Once you've got that, you need this in your view component (which could be a TopComponent or a JFrame):

ExplorerManager.setRootContext(new AbstractNode(new SystemPropertyNode()));

In addition, you'd need to implement ExplorerManager.Provider and add an explorer view. But most of that part can be done via the ui in the IDE. Short, simple, nice demo of Nodes API, ending with you swapping different explorer views around to show that the model is disconnected from the view.

Update 07/23/14: Go here for an updated implementation of the above together with a TopComponent that contains it.


Our application is ported on netbeans platform. We are showing node hierarchy using fie system. Right now we don't want to use the file system api. We want to show it from the database.

Please let me know any ideas/ suggestion on this topic.

Any help would be greatly appreciated.

Posted by guest on April 11, 2010 at 08:44 PM PDT #

Drop me an e-mail at and I will give you some good advice about this.

Posted by Geertjan Wielenga on April 11, 2010 at 09:05 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« August 2015