-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResultsWindow.java
54 lines (38 loc) · 1.34 KB
/
ResultsWindow.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package asteroidymodyfikacja;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.FileNotFoundException;
import javax.swing.JLabel;
/**
* KLASA:ResultsWindow
* OPIS: Okienko z pięcioma najlpeszymi wynikami
*
*/
public class ResultsWindow extends Frame{
// protected JTextArea textArea;
private final static String newline =System.lineSeparator();
public ResultsWindow(int width, int height) throws FileNotFoundException{
super("Top 5 scores");
String [] topFive = ReadFile.read();
JLabel label = new JLabel();
label.setText(topFive[0]+newline+topFive[1]+newline+topFive[2]+newline+topFive[3]+newline+topFive[4]+newline);
//JLabel label1 = new JLabel();
//label1.setText(topFive[0]+newline+topFive[1]+newline+topFive[2]+newline+topFive[3]+newline+topFive[4]+newline);
setLayout(new FlowLayout());
setPreferredSize(new Dimension(width, height));
add(label);
//add(label1);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Frame frame = (Frame) e.getSource();
frame.dispose();
}
});
pack();
setVisible(true);
}
}