Tuesday, 15 September 2015

java - Change the origin of the JScrollpane -



java - Change the origin of the JScrollpane -

i have jscrollpanel implemented correctly . want able draw graph in scrolloable area . jscrollpanel produced has origin (x=0,y=0) in top left corner .

how can alter origin becomes bottom left corner of jscrollpane ?in other words co-ordinate values should increment , right.

i need because origin style corresponds landscape mode in want graph visualized . went through jcomponent doucmentation . not sure api utilize .

you not able alter coordinates of origin of jscrollpane located. in of swing origin defined top left. have manually right y values.

this simple int outputy = jscrollpanelobject.getheight() - inputy;

this flips y values making appear if increasing , right.

edit: in case can grab graphics2d object phone call rotate on it. in cases graphics object handed downwards paint method can casted graphics2d. believe want rotate -90 degrees or -math.pi/2

java swing jscrollpane jcomponent

No comments:

Post a Comment