Also can you show some code that demonstrates the problem you are describing along with instructions on how to make the issue appear.
I jest of course. We have no idea how to fix your issue because you don't show us anything. Be could make a guess but 99.99% chance that the guess would be unrelated to your code.
Why don't you write a small SSCCE (<-click) which shows the problem you are having and explain what is actually behaving incorrectly (i.e. what you expect to happen and the difference between that and what is happening).
Tony Docherty wrote:The problem is MouseInfo.getPointerInfo(); returns the mouse position relative to the top left of the screen whereas the graphics drawing methods draw relative to the top left of the component you are drawing in. You need to subtract the location of the component from the mouse position to get the correct relative value.
And how Im doing this?