Question

I have a bound JTextField and a seperate graph made from a JComponent. When I drag on my graph, a marker should update and the bound JTextField should show its coordinates as it is being dragged. When I am binding, the graph will not repaint until I finish dragging. When I turn off the binding, my graph repaints as a I drag. I do not understand why JGoodies is blocking out my repaint calls while I drag. Does anybody know why this could happen?

My code looks like:

public void dragMarker()
{
    ...some code...
    firePropertyChange("propertyName", oldValue, newValue);
    myJComponent.refresh();
}

Something is going on in JGoodies that I cannot figure out. It should repaint after the binding call completes.

Also, I was just reading that Swing can collapse multiple calls to repaint into one call. Could that be happening to me? My repaint calls are just being collapsed into one call at the end?

Was it helpful?

Solution

My answer, which I don't find perfect satisfaction with, is that I launch a swingworker thread with a scheduled executor at a rate of .3 seconds which runs the firePropertyChangeListeners and updates JGoodies bound code. This means the updates are choppy, but at least the drawing code is almost perfectly smooth. It boggles my mind that this problem occurs. This was the best I could do...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top