I don't think NB has a bug in this respect.
I assume you're changing the property value from within the EDT (as a
DocumentChangeListener, or something), and then fire those events in the
EDT as well, and you expect everything to happen in the EDT. That's
probably slow: you're flooding the EDT with PropertyChangeEVents and
repaints ant the whole thing.
I'd try to use a SwingPropertyChangeSupport instead of a
PropertyChangeSupport and see what happens. that way you differ the
repaint after the events have been fired, and give a break to the EDT.
Cheers,
Antonio
rhizomorph escribió:
> Thanks for all the input you guys, but I've concluded that Netbeans just has a bug in the way it monitors property change events.
>
>
>
> None of your suggestions resolved the issue. Take the following simple Bean for example (3 properties, setting the value of one sets the value of all of them):
>
>
>
>
> Code:
> import java.beans.*;
>
> import java.io.Serializable;
>
>
>
> public class BrokenBean implements Serializable {
>
>
>
> public static final String PROP_A = "a";
>
> public static final String PROP_B = "b";
>
> public static final String PROP_C = "c";
>
>
>
> private int a;
>
> private int b;
>
> private int c;
>
> private PropertyChangeSupport pcs;
>
>
>
> public BrokenBean() {
>
> pcs = new PropertyChangeSupport(this);
>
> }
>
>
>
> public int getA() { return a; }
>
> public int getB() { return b; }
>
> public int getC() { return c; }
>
>
>
> public void setA(int value) { setALL(value); }
>
> public void setB(int value) { setALL(value); }
>
> public void setC(int value) { setALL(value); }
>
>
>
> private void setALL(int value) {
>
> int oldValue = a;
>
> c = b = a = value;
>
> pcs.firePropertyChange(PROP_A, oldValue, a);
>
> pcs.firePropertyChange(PROP_B, oldValue, b);
>
> pcs.firePropertyChange(PROP_C, oldValue, c);
>
> }
>
>
>
> public void addPropertyChangeListener(PropertyChangeListener listener) {
>
> pcs.addPropertyChangeListener(listener);
>
> }
>
>
>
> public void removePropertyChangeListener(PropertyChangeListener listener) {
>
> pcs.removePropertyChangeListener(listener);
>
> }
>
> }
>
>
>
>
>
>
>
> Drag this Bean into a project (Netbeans will placed it in "Other Components"), and try to set any one of the values to 10. Changing one of them should change ALL of them immediately. In fact, if you use a JOptionPane to grab the values directly from the property sheet, you will see that all 3 values ARE updated (but not refreshed). Similarly, if you just MouseOver one of the other properties, you will see that even the ToolTip for that property has been updated. However, the Property Sheet itself is retarded and doesn't seem to realize that it's supposed to actually refresh the values of the other properties as well. And there is no way to tell it to do that (or at least, I can't find one). Now, if you click the mouse away from the bean onto some other object, or if you simply click on the "Properties" node, then you will see the values are all refreshed at once. But this does not happen immediately after setting the values, only when the property sheet loses focus or is to
ld
> to redraw itself some other way.
>
>
>
> CONCLUSION: Netbeans needs to add a Sheet.repaint() method (or something equivalent).
>
>
>
>
>