小编hat*_*keK的帖子

如何使用Timer动态调整帧大小?

我正在尝试使用Timer对象动态调整窗口大小,但没有成功...我在构造函数中设置了面板的首选大小,它很好地设置了窗口的大小,但只有一次.初始化程序后,首选大小会更改,但窗口大小保持不变.为什么?因为构造函数只初始化一次,因此不受大小变化的影响?如果是这样,我怎么能绕过这个来实时调整窗口大小?

我知道这不会解决开头评论中给出的练习中的问题,所以请忽略它:-)

/*
 * Exercise 18.15
 * 
 * "(Enlarge and shrink an image) Write an applet that will display a sequence of
 * image files in different sizes. Initially, the viewing area for this image has
 * a width of 300 and a height of 300. Your program should continuously shrink the
 * viewing area by 1 in width and 1 in height until it reaches a width of 50 and
 * a height of 50. At that point, the …
Run Code Online (Sandbox Code Playgroud)

java user-interface swing timer jframe

2
推荐指数
1
解决办法
596
查看次数

标签 统计

java ×1

jframe ×1

swing ×1

timer ×1

user-interface ×1