Over a million developers have joined DZone.

Data-Aware Component for NetBeans Platform

DZone's Guide to

Data-Aware Component for NetBeans Platform

· Java Zone
Free Resource

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

A data-aware component has the ability to read and display the value of a field from the property assigned to it at runtime. This is different from a standard component, which has content assigned when you write the component during development.

The NetBeans Platform has always had its very own data-aware component, org.openide.explorer.propertysheet.PropertyPanel. However, until this issue was fixed, during the last few days, it was impossible to use that component within Matisse:


Now that the issue is fixed, you can add that component to the Palette in NetBeans IDE and then drag it onto your JPanel or TopComponent in your NetBeans Plaform application.

And here is an example usage:

Result<PersonNode> results = null;

public void componentOpened() {
    results = Utilities.actionsGlobalContext().lookupResult(PersonNode.class);

public void componentClosed() {

public void resultChanged(LookupEvent le) {
    if (!results.allInstances().isEmpty()) {
        PersonNode node = results.allInstances().iterator().next();
        Property[] properties = node.getPropertySets()[0].getProperties();
        for (Property property : properties) {
            if (property.getName().equals("name")) {
            if (property.getName().equals("color")) {

As you can see above, we're listening for a PersonNode. When a PersonNode is available in the Lookup, we get the its properties. Then we assign the properties that we're interested in to the PropertyPanels that we've created for them. In the case of the Color property, since we're using java.awt.Color, we'll see the color displayed in the PropertyPanel (and the color chooser will be displayed when we click on the "..." button to the right of the panel):

In other words, now that the PropertyPanel can be dragged and dropped into the Matisse GUI Builder, we have a great data-aware component that can be used very easily and that functions exactly as one would expect.

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}