There are a number of transformations that you can apply to the Graphics2D object.
translate
The first rectangle is drawn at (10,10)
The second rectangle is drawn following the translate(10,20) operation, so it is 10 right and 20 down.
A Drawn Rectangle
test text