I have a component (MyComponent) based on the AbstractVisionPanel. It includes a subcomponent (MyPanel) extended from jpanel. This panel in turn uses a jscrollpane to display a tree. The “background” property can be bound and any changes to it successfully propagate to the subcomponent. However, the “toolTipText” property does not propagate. The tool tip text is changed on the portions of the component that are not covered by the subcomponent. However, the tool tip text remains at its default value on the subcomponent portion. The code for each property is identical to the degree that the property types differ.
In the constructor for MyPanel:
[code] public MyPanel(MyComponent mycomponent) {
this. mycomponent = mycomponent;
mycomponent.addPropertyChangeListener("toolTipText", this);
mycomponent.addPropertyChangeListener("background", this);[/code]
In the PropertyChangeListener:
[code] @Override
public void propertyChange(PropertyChangeEvent evt) {
String name = evt.getPropertyName();
if ("background".equalsIgnoreCase(name)) {
baseBackground = (Color) TypeUtilities.coerce(evt.getNewValue(), Color.class);
updateBackground();
}
else if ("toolTipText".equalsIgnoreCase(name)) {
baseToolTipText = (String) TypeUtilities.coerce(evt.getNewValue(), String.class);
updateToolTipText();
}
[/code]
The “update” routines:
[code]private void updateBackground() {
Color color = Color.white;
if (baseBackground != null) {
color = baseBackground;
}
this.setBackground(color);
jtree.setBackground(color);
}
private void updateToolTipText() {
String toolTipText = "default tooltip";
if (baseToolTipText != null) {
toolTipText = baseToolTipText;
}
jtree.setToolTipText(toolTipText);
}[/code]
Wondering if it could be something to do with “background” being a bound property and “toolTipText” perhaps not being.