Fixed issue where mapselectorpanel would initialize more than once

This commit is contained in:
Bokros Bálint 2016-05-13 21:33:02 +02:00
parent 12cb4fd10f
commit 5db401d2ab

View File

@ -13,7 +13,7 @@ public class ApplicationFrame implements Runnable
{ {
private JFrame jframe; private JFrame jframe;
private JPanel mapselectorpanel; private JPanel mapselectorpanel = null;
private Display gamepanel; private Display gamepanel;
private JList<File> filelist; private JList<File> filelist;
@ -52,7 +52,6 @@ public class ApplicationFrame implements Runnable
jframe.remove(gamepanel); jframe.remove(gamepanel);
jframe.removeKeyListener(keyHandler); jframe.removeKeyListener(keyHandler);
initMapselector(); initMapselector();
jframe.remove(mapselectorpanel);
jframe.add(mapselectorpanel); jframe.add(mapselectorpanel);
jframe.revalidate(); jframe.revalidate();
} }
@ -63,6 +62,8 @@ public class ApplicationFrame implements Runnable
} }
private void initMapselector() { private void initMapselector() {
if(mapselectorpanel != null)
jframe.remove(mapselectorpanel);
mapselectorpanel = new JPanel(); mapselectorpanel = new JPanel();
DefaultListModel<File> dungeonslist = new DefaultListModel<>(); DefaultListModel<File> dungeonslist = new DefaultListModel<>();