views:

187

answers:

1

I would like to move the origin from top left to bottom middle of the component? I have been playing with AffineTransform class could not get it to work?

+1  A: 

You will need the height and width of the component that you are trying to draw. Assuming you are in the paint(Graphics g) method the simplest way is:

paint(Graphics g){

Graphics2D g2 =  (Graphics2D)g;

g2.translate( component.getWidth()/2,0, component.getHeight()/2.0);

// ... etc ...

}
Clint
this has moved the origin but everything is still upside down.
Hamza Yerlikaya
solved. thank you.
Hamza Yerlikaya