Thank you Michael that has done the trick. I'd actually come up with something very similar (which is encouraging as I'm new to
Java) , however my code required a double-click rather than a single click - didn't quite have the boolean setting properly.
I've cleaned up my code to reflect your example and it's working a treat.
Thanks again. I can see why this site is so popular.