Changed modorder saving to occur on exit
This commit is contained in:
parent
d73a33beae
commit
f25ebace0b
2 changed files with 16 additions and 1 deletions
|
@ -171,7 +171,6 @@ public class FTLModManager {
|
||||||
// Create the GUI.
|
// Create the GUI.
|
||||||
try {
|
try {
|
||||||
final ManagerFrame frame = new ManagerFrame( config, APP_NAME, APP_VERSION, APP_URL, APP_AUTHOR );
|
final ManagerFrame frame = new ManagerFrame( config, APP_NAME, APP_VERSION, APP_URL, APP_AUTHOR );
|
||||||
frame.setDefaultCloseOperation( frame.EXIT_ON_CLOSE );
|
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|
|
@ -113,6 +113,7 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
||||||
this.appAuthor = appAuthor;
|
this.appAuthor = appAuthor;
|
||||||
|
|
||||||
this.setTitle( String.format( "%s v%s", appName, appVersion ) );
|
this.setTitle( String.format( "%s v%s", appName, appVersion ) );
|
||||||
|
this.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
|
||||||
|
|
||||||
JPanel contentPane = new JPanel( new BorderLayout() );
|
JPanel contentPane = new JPanel( new BorderLayout() );
|
||||||
|
|
||||||
|
@ -198,6 +199,21 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
||||||
contentPane.add( statusPanel, BorderLayout.SOUTH );
|
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.
|
// Double-click toggles checkboxes.
|
||||||
localModsTable.addMouseListener(new MouseAdapter() {
|
localModsTable.addMouseListener(new MouseAdapter() {
|
||||||
int prevRow = -1;
|
int prevRow = -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue