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