-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinScreen.java
More file actions
58 lines (50 loc) · 1.4 KB
/
WinScreen.java
File metadata and controls
58 lines (50 loc) · 1.4 KB
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
55
56
57
58
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
@SuppressWarnings("serial")
public class WinScreen extends JFrame {
public static void main(String[] args){
new WinScreen();
}
public WinScreen(){
JPanel pane = new JPanel(new GridBagLayout());
GridBagConstraints c1 = new GridBagConstraints();
//Text
JLabel text = new JLabel("Congratulations! You've discovered all the mines.");
text.setHorizontalAlignment(SwingConstants.CENTER);
Insets padding = new Insets(5, 10, 10, 5);
c1.insets = padding;
c1.gridx = 0;
c1.gridy = 0;
c1.weightx = 1;
c1.gridwidth = 2;
c1.fill = GridBagConstraints.BOTH;
pane.add(text, c1);
//New game button
NewGameButton newGame = new NewGameButton(this);
c1.gridx = 0;
c1.gridy = 1;
c1.weightx = .5;
c1.gridwidth = 1;
c1.fill = GridBagConstraints.NONE;
pane.add(newGame, c1);
//Quit button
QuitButton quit = new QuitButton();
c1.gridx = 1;
c1.gridy = 1;
c1.gridwidth = 1;
c1.weightx = .5;
c1.fill = GridBagConstraints.NONE;
pane.add(quit, c1);
add(pane);
setSize(MinesweeperUtils.getGameScreenSize((.267), (.167)));
setTitle("Winner!");
setLocation(MinesweeperUtils.getCornerPoint(getSize()));
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
}