-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCongrats.java
More file actions
59 lines (44 loc) · 1.58 KB
/
Copy pathCongrats.java
File metadata and controls
59 lines (44 loc) · 1.58 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
59
import java.awt.*;
import javax.swing.*;
/**
* A frame that congratulates the user for winning the game
*
* @Team MAGA
* @Author Gajun Young - 16440714
* @Author Royal Thomas - 16326926
* @Author Richard Otroshchenko - 16353416
*/
public class Congrats {
public Congrats(String userName){
// declare frames.
JDialog gameFinished = new JDialog();
JPanel congratsPanel = new JPanel();
// Make sure user knows that this is the most important frame for them.
gameFinished.setAlwaysOnTop (true);
// Add banner
try{
congratsPanel.add(CluedoUI.imageToLabel("won.png"));
}catch(Exception ex){
System.out.println(ex);
}
JLabel name = new JLabel("Congrats, "+userName+"! You're one hell of a detective!");
name.setFont(new Font("TimesRoman", Font.PLAIN, 30));
//name.setBorder(BorderFactory.createEmptyBorder(100, 20, 10, 20));
gameFinished.add(congratsPanel);
gameFinished.setLayout(new GridBagLayout());
// Housekeeping
GridBagConstraints c = new GridBagConstraints();
c.weightx = 0.5;
c.gridx = 0;
c.gridy = 1;
c.ipady = 40;
congratsPanel.setBackground(new Color(170,134, 188));
gameFinished.add(name, c);
gameFinished.setModal (true);
gameFinished.setAlwaysOnTop (true);
gameFinished.setModalityType (Dialog.ModalityType.APPLICATION_MODAL);
gameFinished.setSize(864,500);
gameFinished.setLocationRelativeTo(null);
gameFinished.setVisible(true);
}
}