Those not actually developing on top of the NetBeans Platform themselves will possibly never fully understand this, but time and again NetBeans Platform developers are direct beneficiaries of improvements made to NetBeans IDE. A good example is the brand new org.openide.explorer.view.CheckableNode class, which comes from issue 159546, supporting checkboxes next to nodes, as below in the IDE:

However, since that class is also available as a public class, for certain explorer views, I'm able to create my own nodes with checkboxes:

How to do this yourself? Read the related Javadoc and then pass a CheckableNode into the node Lookup. A simplistic example is below, inside a class that extends ChildFactory:

protected Node createNodeForKey(String name) {
    Node node = new AbstractNode(Children.create(new CustomerInfoChildFactory(name), true), Lookups.singleton(new CheckableNode() {

        public boolean isCheckable() {
            return true;

        public boolean isCheckEnabled() {
            return true;

        public Boolean isSelected() {
            return true;

        public void setSelected(Boolean arg0) {


    return node;

Strangely, clicking on a checkbox does not check/uncheck it, so maybe I'm doing something wrong. Plus, the CheckableNode is NOT available for ALL explorer views. In the screenshot above, I'm using an OutlineView. But I also tried a BeanTreeView and there this support is not provided.

In other news. I've started adding a new section on Multiview Windows to the File Type Integration Tutorial.


I guess it ain't working because your setSelected method does nothing. Try making isSelected/setSelected actually based on a Boolean selected variable and see if it works.

Posted by Michael Nascimento Santos on April 04, 2009 at 08:07 AM PDT #

Did you see this web app:

Whenever I read Javalobby, I think Java in the browser is dead. This is the only example so far that proves it wrong.

One should write an article on Javalobby introducing all the Java web apps that are really useful. There must be more like out there, right?

Posted by Richard on April 04, 2009 at 01:20 PM PDT #

I absolutely love the CheckableNode interface. However, how can I add a listener to be notified when a checkbox is selected/deselected? I need to deselect a parent node if none of its children nodes are selected. Likewise, I need the checkboxes to behave like radio buttons (only allow one of the siblings to be selected at any one time). Help!

Posted by Richard St. John on July 24, 2009 at 04:20 AM 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.


« July 2016