You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
He has you implement a new class and then talk to it. I have the class created. I need to do two things one
registering to the global toolkit
Toolkit tk = Toolkit.getDefaultToolkit( );
tk.addAWTEventListener(WindowSaver.getInstance( ),
AWTEvent.WINDOW_EVENT_MASK);
which might need to be done on both the windowsaver and the main code but I'm not sure.
And b adding a save geometry call to windowsaver in my quit event.
I'm not going to add this actual Quit item but simply modify what I'm already doing on shutdown.
menu.add(new AbstractAction("Quit") {
public void actionPerformed(ActionEvent evt) {
try {
WindowSaver.saveSettings( );
System.exit(0);
} catch (Exception ex) {
System.out.println(ex);
}
}
});
The text was updated successfully, but these errors were encountered:
Why is this hard. The article above is implemented and works... mostly.
but it's awkward. For example if you maximize, quit and open the window opens at the same geometry that it used to be. NOT maximized. Which means that you actuallly loose one little line around the edge of the screen which A) looks pretty silly and B) WILL cause a problem later I can guarantee it.
There's a cool hack here:
http://codeidol.com/java/swing/Windows,-Dialogs,-and-Frames/Save-Window-Settings/
He has you implement a new class and then talk to it. I have the class created. I need to do two things one
registering to the global toolkit
Toolkit tk = Toolkit.getDefaultToolkit( );
tk.addAWTEventListener(WindowSaver.getInstance( ),
AWTEvent.WINDOW_EVENT_MASK);
which might need to be done on both the windowsaver and the main code but I'm not sure.
And b adding a save geometry call to windowsaver in my quit event.
I'm not going to add this actual Quit item but simply modify what I'm already doing on shutdown.
menu.add(new AbstractAction("Quit") {
public void actionPerformed(ActionEvent evt) {
try {
WindowSaver.saveSettings( );
System.exit(0);
} catch (Exception ex) {
System.out.println(ex);
}
The text was updated successfully, but these errors were encountered: