开发者

How to zoom in and out the image in the line using JSlider in java?

开发者 https://www.devze.com 2023-04-12 23:19 出处:网络
I have a diagonal line start开发者_高级运维ing from the bottom left part going to the upper right corner of the screen. I have also a human image drawn to a canvas having a 2 meters interval in the th

I have a diagonal line start开发者_高级运维ing from the bottom left part going to the upper right corner of the screen. I have also a human image drawn to a canvas having a 2 meters interval in the that diagonal line. I have created a JSlider below the canvas. Whenever I adjust the slider to the left, I want the images to zoom out and if it is to the right it will zoom in the images and that is my problem.

Could you give me some idea how to do it?


If you want to zoom in use

 context.scale(scaleFactor,scaleFactor)

To zoom in use a number bigger then 1 and to zoom out use a number less then 1 like 0.6

0

精彩评论

暂无评论...
验证码 换一张
取 消