// position _boardRenderer.setSize(512, 512); _boardRenderer.setLocation(100, 100);
The problem I have is, though the component is drawn perfectly, the mouse events are handled incorrectly...with the reported mouse clicks being reported as happening about 20 pixels lower and 10 pixels to the right of where they actually are.
I don't get it. I draw a red rectangle around the bounds of the board, and it's exactly where it needs to be. I don't understand this 20/10 offset. Has anyone else seen this when writing a custom, self-drawing component?
See if you can modify this to demonstrate the offset behavior
posted 14 years ago
Ah, thank you...
I transplanted in your code and observed the same faulty behavior. After hours, It occurred to me that the weird offset just happened to come awfully close to the size of the borders on the window. Then, I swapped in full-screen support to the screen and it worked!
Turns out, the Window reference was faulty with the windowed version of the code because it included the border as part of the whole window...while m later getGraphics() code did not. Yuck!
So, all patched up...thanks!!!
My pie came with a little toothpic holding up this tiny ad: