diff --git a/cicaprojekt/ApplicationFrame.java b/cicaprojekt/ApplicationFrame.java index 89e0151..4d8f84c 100644 --- a/cicaprojekt/ApplicationFrame.java +++ b/cicaprojekt/ApplicationFrame.java @@ -4,6 +4,8 @@ import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.plaf.basic.BasicInternalFrameTitlePane; import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.io.File; import java.util.ArrayList; import java.util.List; @@ -20,6 +22,13 @@ public class ApplicationFrame implements Runnable public ApplicationFrame(){} + private class ListMouseHandler extends MouseAdapter{ + @Override + public void mouseClicked(MouseEvent e) { + JOptionPane.showMessageDialog(null, ((JList)e.getComponent()).getSelectedValue().toString()); + } + } + public void init(){ jframe = new JFrame(); jframe.setMinimumSize(new Dimension(600, 400)); @@ -39,10 +48,13 @@ public class ApplicationFrame implements Runnable filelist = new JList<>(dungeonslist); filelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); filelist.setLayoutOrientation(JList.HORIZONTAL_WRAP); + filelist.addMouseListener(new ListMouseHandler()); mapselectorpanel.add(filelist); jframe.add(mapselectorpanel); + + //TODO rewrite demo ListMouseHandler and do Game stuff... } @Override