when i click on a button which deletes itself or a Component containing it upon mouseDown, the corresponding mouseUp goes to what ever was under that button or Component. This behaviour is weird to say the least. That mouseUp should end nowhere as logic dictates that a mouseUp can only occur after a mouseDown and if the Component receiving that rogue mouseUp depends on that logic havoc happens.
Is that a bug in mouse handling or is there a deeper philosophy behind?
The actual problem is not the mouseDown or the deletion. The actual problem is that the mouseDown, which went to the button, has a corresponding mouseUp which after button deletion goes to another component. So the problem is that the another component receives a mouseUp without having first received a corresponding mouseDown, but depends on that order.
A workaround, which doesn’t solve the original problem but may result in an equivalent user experience: hide the component on mouseDown, then delete it on mouseUp