开发者

Java applet scale

开发者 https://www.devze.com 2023-03-12 04:25 出处:网络
开发者_JAVA百科I have a java game that I have made, is it a Canvas in a JFrame to run as an application and an applet.
开发者_JAVA百科

I have a java game that I have made, is it a Canvas in a JFrame to run as an application and an applet.

When running as an applet, I want it so that when the user resizes the window, the game scales to fit the new size window.

Is there anyway of resizing the canvas and all the images or shapes that I have drawn on it to fit the new size window, or do I have to go though and change the code on all my objects and the positions they draw?

Any help would be very useful :)


You would have to add scaling to your painting. A transformation applied to your graphics might be the easiest way. You would determine the current size of the Canvas and scale based on the standard size.

0

精彩评论

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

关注公众号