-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLandingPage2.java
More file actions
97 lines (76 loc) · 2.46 KB
/
Copy pathLandingPage2.java
File metadata and controls
97 lines (76 loc) · 2.46 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.ImageIcon;
public class LandingPage2 extends JFrame implements ActionListener {
public static void main(String args[]) {
new LandingPage2();
}
public LandingPage2() {
JFrame frame = new JFrame();
JPanel LandingPageMain = (JPanel) frame.getContentPane();
frame.setSize(600, 400);
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
ImageIcon Logo = new ImageIcon("./assets/MonopolyLogo.jpg");
String names[] = new String[2];
JLabel LogoLabel = new JLabel(Logo);
JButton startButton = new JButton("START");
JLabel P1Label = new JLabel("PLAYER ONE");
JLabel P2Label = new JLabel("PLAYER TWO");
Font currentFont = P1Label.getFont();
Font label = new Font("Serif", Font.BOLD, 20);
P1Label.setFont(label);
P2Label.setFont(label);
JButton p1 = new JButton("");
JButton p2 = new JButton("");
p1.setBackground(Color.blue);
p2.setBackground(Color.red);
p1.setPreferredSize(new Dimension(30, 30));
p2.setPreferredSize(new Dimension(30, 30));
JTextField p1Name = new JTextField("Enter your name", 15);
JTextField p2Name = new JTextField("Enter your name", 15);
JPanel LogoPane = new JPanel();
LogoPane.add(LogoLabel);
constraints.gridx = 5;
constraints.gridy = 1;
panel.add(LogoPane, constraints);
constraints.gridx = 5;
constraints.gridy = 2;
panel.add(startButton, constraints);
constraints.gridx = 4;
constraints.gridy = 3;
// constraints.gridheight = 2;
// constraints.gridwidth = 2;
panel.add(P1Label, constraints);
constraints.gridx = 6;
constraints.gridy = 3;
// constraints.gridheight = 2;
// constraints.gridwidth = 2;
panel.add(P2Label, constraints);
constraints.gridx = 6;
constraints.gridy = 2;
panel.add(p1, constraints);
constraints.gridx = 4;
constraints.gridy = 2;
panel.add(p2, constraints);
constraints.gridx = 6;
constraints.gridy = 4;
panel.add(p1Name, constraints);
constraints.gridx = 4;
constraints.gridy = 4;
panel.add(p2Name, constraints);
startButton.addActionListener(this);
LandingPageMain.add(panel);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent evt) {
doMyButtonAction();
repaint();
}
public void doMyButtonAction() {
names[1] = p1Name.getText();
names[2] = p2Name.getText();
return names;
}
}