Geertjan's Blog

  • April 4, 2009


Geertjan Wielenga
Product Manager
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.

Join the discussion

Comments ( 3 )
  • Michael Nascimento Santos Saturday, April 4, 2009

    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.

  • Richard Saturday, April 4, 2009

    Did you see this web app: http://www.chartle.net/

    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 http://www.chartle.net/ out there, right?

  • Richard St. John Friday, July 24, 2009

    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!

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.