-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartScreen.java
More file actions
56 lines (47 loc) · 1.72 KB
/
Copy pathStartScreen.java
File metadata and controls
56 lines (47 loc) · 1.72 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
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class StartScreen extends JPanel implements ActionListener
{
public static GamePanel gamePanel = new GamePanel();
JFrame startFrame;
JButton startButton;
JLabel gameTitle;
JLabel creatorCredit;
JTextField enterPlayerName;
public StartScreen()
{
startFrame = new JFrame();
startButton = new JButton("Start");
gameTitle = new JLabel("Lava Escape!");
creatorCredit = new JLabel("By: William Kim");
enterPlayerName = new JTextField("Enter Username");
gameTitle.setBounds(330, 200, 1000, 100);
gameTitle.setFont(new Font("SansSerif", Font.PLAIN, 90));
startFrame.add(gameTitle);
creatorCredit.setBounds(500, 300, 1000, 100);
creatorCredit.setFont(new Font("SansSerif", Font.PLAIN, 30));
startFrame.add(creatorCredit);
enterPlayerName.setBounds(450, 500, 300, 100);
enterPlayerName.setFont(new Font("SansSerif", Font.PLAIN, 30));
startFrame.add(enterPlayerName);
enterPlayerName.addActionListener(this);
startButton.setBounds(400, 700, 400, 100);
startButton.setFocusable(false);
startButton.setFont(new Font("SansSerif", Font.BOLD, 50));
startFrame.add(startButton);
startButton.addActionListener(this);
startFrame.setSize(1200, 900);
startFrame.getContentPane().setBackground(Color.red);
startFrame.setResizable(false);
startFrame.setLayout(null);
startFrame.setVisible(false);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == startButton)
{
GamePanel.startScreenFrame = false;
}
}
}