Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

save search criteria when deiconified.....  RSS feed

 
Shirley Li
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there a java built-in methods in Java1.4 Swing which can save the search criteria, settings when user deiconified. And when the program tells the front end to iconified, the settings of the JFrame would still be the same??
For now, the program dispose the current window, and reopen it again using pack(), but the settings and search criteria for the front end would be lost??
Thanks,
shirley
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the contents are being lost because the frame is being dispose()-ed when it is being iconified. If you really need to do this (due to performance problems or something) then you could use the java.util.Properties class to save settings temporarily. Properties is basically just a HashMap that has some built in methods to easily be written out to a file. Otherwise, if you don't need to dispose when the frame is iconified, don't. I think that is what is causing the data to be lost in the first place.
 
Shirley Li
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Natha,
Actually, what i am trying to do is to deiconify the frame when it is being iconified by the users. I found the following code from the web
int state = frame.getExtendedState();
state = state & (~Frame.ICONIFIED);
frame.setExtendedState(state);
I tried it out in my program and it worked.
But, thanks for you help!
shirley
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!