vtm-theme-comparator: fix application exit #387
This commit is contained in:
parent
81a270428c
commit
4532e397c0
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@ -35,15 +36,15 @@ import javax.swing.JMenuItem;
|
||||
|
||||
public class MainMenu extends JMenuBar {
|
||||
|
||||
private final MapLoader mapLoader;
|
||||
private final MainWindow mainWindow;
|
||||
private final JMenu fileMenu = new JMenu("File");
|
||||
private final JMenu viewMenu = new JMenu("View");
|
||||
private final JMenu posMenu = new JMenu("Pos");
|
||||
private ThemeLoader themeLoader;
|
||||
|
||||
MainMenu(MapLoader mapLoader, BothMapPositionHandler mapPosition) {
|
||||
this.mapLoader = mapLoader;
|
||||
mapPosition.setCallBack(this);
|
||||
MainMenu(MainWindow mainWindow) {
|
||||
this.mainWindow = mainWindow;
|
||||
mainWindow.bothMapPositionHandler.setCallBack(this);
|
||||
addFileEntrys();
|
||||
addViewEntrys();
|
||||
addPosEntrys();
|
||||
@ -86,7 +87,7 @@ public class MainMenu extends JMenuBar {
|
||||
item.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
mainWindow.exit();
|
||||
}
|
||||
});
|
||||
return item;
|
||||
@ -114,7 +115,7 @@ public class MainMenu extends JMenuBar {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
mapLoader.loadMap(new File(mapPath), true);
|
||||
mainWindow.mapLoader.loadMap(new File(mapPath), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -33,8 +33,8 @@ import javax.swing.WindowConstants;
|
||||
class MainWindow extends JFrame {
|
||||
|
||||
private final VtmPanel vtmPanel;
|
||||
private final MapLoader mapLoader;
|
||||
private final BothMapPositionHandler bothMapPositionHandler;
|
||||
final MapLoader mapLoader;
|
||||
final BothMapPositionHandler bothMapPositionHandler;
|
||||
private final MapsforgeMapPanel mapsforgeMapPanel;
|
||||
private final InfoPanel infoPanel;
|
||||
private final MapsPanel mapsPanel;
|
||||
@ -66,7 +66,7 @@ class MainWindow extends JFrame {
|
||||
|
||||
mapLoader = new MapLoader(mapsforgeMapPanel, vtmPanel, bothMapPositionHandler);
|
||||
|
||||
MainMenu mainMenu = new MainMenu(mapLoader, bothMapPositionHandler);
|
||||
MainMenu mainMenu = new MainMenu(this);
|
||||
setJMenuBar(mainMenu);
|
||||
|
||||
infoPanel = new InfoPanel(vtmPanel, mapsforgeMapPanel, mainMenu);
|
||||
@ -86,12 +86,15 @@ class MainWindow extends JFrame {
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
mapsforgeMapPanel.destroy();
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
dispose();
|
||||
System.exit(0);
|
||||
exit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void exit() {
|
||||
mapsforgeMapPanel.destroy();
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
dispose();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@ -34,6 +35,7 @@ public class VtmPanel extends JPanel {
|
||||
|
||||
public VtmPanel(MapApplicationAdapter.MapReadyCallback callback) {
|
||||
this.setLayout(null);
|
||||
LwjglApplicationConfiguration.disableAudio = true;
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
config.width = 300;
|
||||
config.height = 300;
|
||||
|
Loading…
x
Reference in New Issue
Block a user