Closes #11. Now there list is scrollable in case of > 4 maps.

This commit is contained in:
Kjistóf 2016-05-14 12:40:42 +02:00
parent 6c375f94bf
commit a9939b3600

View File

@ -18,6 +18,7 @@ public class ApplicationFrame implements Runnable
private Display gamepanel; private Display gamepanel;
private JList<File> filelist; private JList<File> filelist;
private JScrollPane filescroll;
private Dimension menuDimension = new Dimension(640, 395); private Dimension menuDimension = new Dimension(640, 395);
@ -95,9 +96,11 @@ public class ApplicationFrame implements Runnable
filelist = new JList<>(dungeonslist); filelist = new JList<>(dungeonslist);
filelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); filelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
filelist.setLayoutOrientation(JList.HORIZONTAL_WRAP);
filelist.addMouseListener(new ListMouseHandler()); filelist.addMouseListener(new ListMouseHandler());
filelist.setMaximumSize(new Dimension(400, 80)); filelist.setLayoutOrientation(JList.VERTICAL);
filelist.setVisibleRowCount(4);
filescroll = new JScrollPane(filelist);
mapselectorpanel.setMinimumSize(menuDimension); mapselectorpanel.setMinimumSize(menuDimension);
mapselectorpanel.setPreferredSize(menuDimension); mapselectorpanel.setPreferredSize(menuDimension);
@ -107,7 +110,7 @@ public class ApplicationFrame implements Runnable
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if(e.getX() > 229 && e.getY() > 186 && e.getX() < 433 && e.getY() < 219) { if(e.getX() > 229 && e.getY() > 186 && e.getX() < 433 && e.getY() < 219) {
mapselectorpanel.add(filelist, BorderLayout.SOUTH); mapselectorpanel.add(filescroll, BorderLayout.SOUTH);
mapselectorpanel.updateUI(); mapselectorpanel.updateUI();
} }