added highscore jframe to highscore gui
parent
093c9bf601
commit
2aaac10f48
|
|
@ -1,10 +1,60 @@
|
||||||
package de.hs_mannheim.informatik.pr2projekt.gui;
|
package de.hs_mannheim.informatik.pr2projekt.gui;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
public class HighscoreGUI {
|
public class HighscoreGUI {
|
||||||
|
|
||||||
public static void highscoreScreen() {
|
public static void highscoreScreen(String[] filepath){
|
||||||
// TODO Auto-generated method stub
|
JFrame frame = new JFrame("Highscores");
|
||||||
|
JPanel highscorePanel = new JPanel(new BorderLayout());
|
||||||
|
JPanel buttonPanel = new JPanel(new GridLayout(7,1,10,10));
|
||||||
|
String[] buttons = {
|
||||||
|
"Highscore 4x4 - leicht",
|
||||||
|
"Highscore 5x5 - leicht",
|
||||||
|
"Highscore 8x8 - leicht",
|
||||||
|
"Highscore 8x8 - medium",
|
||||||
|
"Highscore 10x10 - medium",
|
||||||
|
"Highscore 15x15 - medium"
|
||||||
|
};
|
||||||
|
for(int i=0;i<buttons.length;i++){
|
||||||
|
JButton b0 = new JButton(buttons[i]);
|
||||||
|
buttonPanel.add(b0);
|
||||||
|
int[] count = {i};
|
||||||
|
char rowChar = buttons[i].charAt(0);
|
||||||
|
String[] row = {String.valueOf(rowChar)};
|
||||||
|
b0.addActionListener(e -> {
|
||||||
|
int j = count[0];
|
||||||
|
String[] paths = {
|
||||||
|
"Hitori_Highscores/Hitori4x4_leicht.txt",
|
||||||
|
"Hitori_Highscores/Hitori5x5leicht.txt",
|
||||||
|
"Hitori_Highscores/Hitori8x8leicht.txt",
|
||||||
|
"Hitori_Highscores/Hitori8x8medium.txt",
|
||||||
|
"Hitori_Highscores/Hitori10x10medium.txt",
|
||||||
|
"Hitori_Highscores/Hitori15x15_medium.txt"
|
||||||
|
};
|
||||||
|
showHighscores(paths[j]);
|
||||||
|
frame.dispose();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
JButton b = new JButton("Zurück");
|
||||||
|
b.addActionListener(e -> {
|
||||||
|
frame.dispose();
|
||||||
|
MenuGUI.getPath(filepath);
|
||||||
|
});
|
||||||
|
buttonPanel.add(b);
|
||||||
|
frame.setVisible(true);
|
||||||
|
frame.setSize(600,600);
|
||||||
|
highscorePanel.add(buttonPanel, BorderLayout.CENTER);
|
||||||
|
JLabel text0 = new JLabel("Level für Highscore Liste auswählen!");
|
||||||
|
highscorePanel.add(text0, BorderLayout.NORTH);
|
||||||
|
frame.setDefaultCloseOperation(0);
|
||||||
|
frame.add(highscorePanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue