Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remember window positions in swing

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.

like image 918
AvrDragon Avatar asked Sep 24 '12 13:09

AvrDragon


1 Answers

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).

like image 67
Adam Dyga Avatar answered Sep 28 '22 16:09

Adam Dyga