Thanks for those links, but I'm not sure that's exactly what I'm looking for. There seems to be plenty of information about how to create your own nodes/property sheets etc, but I'm not concerned with that really. I just want access to the property sheet that NETBEANS itself uses to display the properties of an object that has been dragged into the GUI from the palette (not one that I create).
All I'm really trying to say is: "Hey Netbeans, pay attention to these properties and refresh them whenever they change, even if the change wasn't made through the property sheet". Because currently, ONLY changes made through the property sheet are actually updated in the property sheet. If one changes variable A through the property sheet, and variable B is changed as a result, only A's value will be refreshed - B will still get changed in the actual object, but the property sheet will still show the old value.
I've spent the last two days reading endless javadoc about the NodesAPI (and related), which seems to let me do everything EXCEPT the one very simple task I'm trying to accomplish.
In my latest attempt, I tried to use PropertySupport.Reflection to get/set values on the property sheet for a given Bean, like this...
Code:
public void setA(int newValue) {
int oldA = A;
int oldB = B;
A = newValue;
B = 5*A; // make some dependent change to B.
propertySupport.firePropertyChange("propertyA", oldA, A);
propertySupport.firePropertyChange("propertyB", oldB, B); // Does NOT update the property sheet.
Property prop = new PropertySupport.Reflection(this, Integer.TYPE, "B"); // This fails!
prop.setValue(B); // This MIGHT work, if I can even get this far!
}
But I can't seem to instantiate a Property variable to save my life, I get:
> java.lang.NoClassDefFoundError: org/openide/nodes/PropertySupport$Reflection
Whatever the hell that means - it compiles fine, so I don't know why it all-of-a-sudden realizes that a class definition is missing. I also tried using Property prop = new PropertySupport.Reflection(this, Integer.class, "B"); because I wasn't sure of the proper call, but this fails too.
Any ideas? I can't possibly be the first person to create a bean in which two or more modifiable properties also happen to be interdependent.
Wade Chandler wrote:
> Not sure off the top of my head. Have you seen:
>
http://platform.netbeans.org/tutorials/nbm-nodesapi2.html>
> Maybe there is something you missed in there. If that doesn't help let me know, and I'll see if I can do up a test at some point. What version are you using?
>
> Wade
>