When you draw a rectangle with size (10,10) starting from point (10,10) the Graphics will fill the pixels [(10,10),(10,11), ... , (10,19) ], so the line will take exactly 10 pixels space. So if you want another rectangle to overlap with each other then you have to start painting from (10,19).

Maybe attached picture (it is exactly what I got from your code) will explain this better