Thanks for your comments.
Sorry, I wasn't clear. I'm not removing/adding the Listener, just making the Listener ignore callbacks. The set/isCascading calls are all from the componentResized call, so are only called during callbacks which are on the Swing
thread. I don't think that violates the single threaded rule, but I've now inserted
to check.
This solution doesn't rely on event timing - just a sledge-hammer 100 millisecond dead time.
(I'm not particularly defending it, just trying to learn)
Two things I don't like about the above solution: firstly the frequent calls to the real time clock, and secondly the arbitrary 100 milliseconds.
It would be cleaner if I could remove the listener, and then put a SwingWorker on the end of the Event Queue and use that to re-add the Listener - is InvokeLater guaranteed to be invoked after all pre-existing Events? Have just looked it up. I see that this is the case.
Many thanks