Changed modorder saving to occur on exit

This commit is contained in:
Vhati 2013-08-26 09:46:06 -04:00
parent d73a33beae
commit f25ebace0b
2 changed files with 16 additions and 1 deletions

View file

@ -171,7 +171,6 @@ public class FTLModManager {
// Create the GUI.
try {
final ManagerFrame frame = new ManagerFrame( config, APP_NAME, APP_VERSION, APP_URL, APP_AUTHOR );
frame.setDefaultCloseOperation( frame.EXIT_ON_CLOSE );
frame.setVisible(true);
SwingUtilities.invokeLater(new Runnable() {

View file

@ -113,6 +113,7 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
this.appAuthor = appAuthor;
this.setTitle( String.format( "%s v%s", appName, appVersion ) );
this.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
JPanel contentPane = new JPanel( new BorderLayout() );
@ -198,6 +199,21 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
contentPane.add( statusPanel, BorderLayout.SOUTH );
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing( WindowEvent e ) {
List<ModFileInfo> sortedMods = new ArrayList<ModFileInfo>();
for ( int i=0; i < localModsTableModel.getRowCount(); i++ ) {
sortedMods.add( localModsTableModel.getItem(i) );
}
saveModOrder( sortedMods );
ManagerFrame.this.setVisible( false );
ManagerFrame.this.dispose();
System.exit( 0 );
}
});
// Double-click toggles checkboxes.
localModsTable.addMouseListener(new MouseAdapter() {
int prevRow = -1;