记住秋千上的窗户位置 [英] Remember window positions in swing

查看:88
本文介绍了记住秋千上的窗户位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的swing应用程序,我想让它记住所有窗口,jframe等的大小.因此,如果用户按自己的喜好调整窗口大小,则下次该窗口看起来完全一样.

I have a pretty big swing application and i want to make it remember sizes of all windows, jframes etc. So if user resized window how he likes, next time the window looks exact the same way.

我是否有更好的选择来解决它,但请在

Do i have a better option to solve it, but manually write the position/size of each window in Preferences? Is there any convinient way to store the order of columns in JTable? May be some framework? Just don't want to write boilerplate.

不幸的是,整个大应用程序不能进行序列化.

Serialization of the whole big app is unfortunately not an option.

推荐答案

不,没有.不要忘了写主JFrame的边界(位置/大小).

No, there isn't. Don't forget to write the bounds (position/size) of the main JFrame.

还原窗口位置后,不要忘记检查该位置是否确实在显示的桌面区域中.屏幕配置可能会在应用程序运行之间发生变化(例如,当用户从台式机显示器上断开笔记本电脑的连接时).

And after restoring window position don't forget to check if the position is really in displayed desktop area. The screen configuration may change between application runs (eg. when the user disconnects laptop from a desktop monitor).

这篇关于记住秋千上的窗户位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆