@@ -32,31 +32,25 @@ public class Endscreen extends JDialog {
32
32
public Endscreen (int score ) {
33
33
this .score = score ;
34
34
setTitle ("Endscreen" );
35
- setDefaultCloseOperation (WindowConstants .EXIT_ON_CLOSE );
35
+ setDefaultCloseOperation (WindowConstants .DISPOSE_ON_CLOSE );
36
36
setBounds (100 , 100 , 700 , 700 );
37
37
getContentPane ().setLayout (new BorderLayout ());
38
38
contentPanel .setBorder (new EmptyBorder (5 , 5 , 5 , 5 ));
39
39
contentPanel .setLayout (new BorderLayout (0 , 0 ));
40
40
getContentPane ().add (contentPanel , BorderLayout .CENTER );
41
41
42
- JButton btnNewButton = new JButton ("Play again" );
42
+ final JButton btnNewButton = new JButton ("Play again" );
43
43
btnNewButton .setMnemonic (KeyEvent .VK_ENTER );
44
- btnNewButton .addActionListener (e -> {
45
- Main .startGame ();
46
- dispose ();
47
- });
44
+ btnNewButton .addActionListener (e -> { Main .startGame (); dispose (); });
48
45
btnNewButton .setFont (new Font ("Times New Roman" , Font .PLAIN , 15 ));
49
46
contentPanel .add (btnNewButton , BorderLayout .SOUTH );
50
47
51
- JLabel lblDeinPunktestand = new JLabel ("Dein Punktestand: " + String .valueOf (score ));
48
+ final JLabel lblDeinPunktestand = new JLabel ("Dein Punktestand: " + String .valueOf (score ));
52
49
lblDeinPunktestand .setFont (new Font ("Times New Roman" , Font .PLAIN , 25 ));
53
50
contentPanel .add (lblDeinPunktestand , BorderLayout .NORTH );
54
51
55
- Image resultImage = Toolkit .getDefaultToolkit ()
56
- .getImage (
57
- this .getClass ()
58
- .getResource ((score < goodOrBadResult ) ? "/Try_Again.jpg" : "/1211548-200.png" )
59
- );
52
+ final Image resultImage = Toolkit .getDefaultToolkit ()
53
+ .getImage (this .getClass ().getResource (score < goodOrBadResult ? "/Try_Again.jpg" : "/1211548-200.png" ));
60
54
resultImage .flush ();
61
55
}
62
56
0 commit comments