Implemented main menu
This commit is contained in:
parent
9d551ad376
commit
a17de768eb
@ -1,5 +1,6 @@
|
||||
package cicaprojekt;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import java.awt.*;
|
||||
@ -40,7 +41,7 @@ public class ApplicationFrame implements Runnable
|
||||
public void init(){
|
||||
jframe = new JFrame();
|
||||
jframe.setFocusable(true);
|
||||
jframe.setMinimumSize(new Dimension(600, 400));
|
||||
jframe.setMinimumSize(new Dimension(640, 395));
|
||||
jframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
initMapselector();
|
||||
@ -64,7 +65,18 @@ public class ApplicationFrame implements Runnable
|
||||
private void initMapselector() {
|
||||
if(mapselectorpanel != null)
|
||||
jframe.remove(mapselectorpanel);
|
||||
mapselectorpanel = new JPanel();
|
||||
mapselectorpanel = new JPanel() {
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
try {
|
||||
g.drawImage(ImageIO.read(new File("Menu.png")), 0, 0, null);
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
Control.ioErrorMessage();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DefaultListModel<File> dungeonslist = new DefaultListModel<>();
|
||||
File dir = new File(System.getProperty("user.dir"));
|
||||
@ -80,8 +92,21 @@ public class ApplicationFrame implements Runnable
|
||||
filelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
filelist.setLayoutOrientation(JList.HORIZONTAL_WRAP);
|
||||
filelist.addMouseListener(new ListMouseHandler());
|
||||
filelist.setMaximumSize(new Dimension(400, 80));
|
||||
|
||||
mapselectorpanel.setLayout(new BorderLayout());
|
||||
mapselectorpanel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if(e.getX() > 229 && e.getY() > 186 && e.getX() < 433 && e.getY() < 219) {
|
||||
//JOptionPane.showConfirmDialog(mapselectorpanel, "Ingyen sör");
|
||||
mapselectorpanel.add(filelist, BorderLayout.SOUTH);
|
||||
mapselectorpanel.updateUI();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mapselectorpanel.add(filelist);
|
||||
}
|
||||
|
||||
private void setGameParams(File dungeonFile) throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user