-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKEY.java
More file actions
104 lines (84 loc) · 2.31 KB
/
KEY.java
File metadata and controls
104 lines (84 loc) · 2.31 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
98
99
100
101
102
103
104
/*
Aditi Dantuluri
* 3/12/22
* KEY.java
* Week one of game project*/
import javax.swing.*;
import java.awt.*;
public class KEY extends JFrame
{
public KEY()
//make start panel
{
super ("KEY");
setSize( 600, 600);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLocation(200,100);
setResizable(true);
Panel pan = new Panel();
setContentPane(pan);
setVisible(true);
}
public static void main (String [] args)
{
KEY JoeBobKim = new KEY();
}
}
class Panel extends JPanel
{
public Panel()
{
setBackground(new Color( 255, 179, 199));
}
public void paintComponent(Graphics g)
//add in the start panels text introductions and colors
{
super.paintComponent(g);
g.setColor(Color.RED);
Font sericBold20 = new Font("Luminari",Font.PLAIN,35);
g.setFont(sericBold20);
g.drawString("WELCOME TO...", 170, 40);
Font PREDATOR = new Font("Luminari",Font.BOLD,50);
g.setFont(PREDATOR);
g.drawString("PREDATORS KEY",87,130);
/*
//A
g.drawLine(140,300,180,200);
g.drawLine(180,200,220,300);
g.drawLine(160,260,200,260);
*/
}
public void newframe() {
//make instructions button to know how to play game
JButton start1 = new JButton("intructions");
start1.addActionListener(e -> cl.previous(panel));
start1.setPreferredSize(new Dimension(600,120));
start1.setFont(new Font("Luminari", Font.PLAIN, 30));
start1.setOpaque(true);
start1.setBackground(Color.RED);
//this is the action listener
start1.setBounds(110,380,400,100);
add(start1);
//make start button
JButton start = new JButton("start");
start.addActionListener(e -> cl.next(panel));
start.setPreferredSize(new Dimension(600,120));
start.setFont(new Font("Luminari", Font.PLAIN, 30));
start.setOpaque(true);
start.setBackground(Color.RED);
//this is the action listener
start.setBounds(110,210,400,100);
add(start);
JButton start1 = new JButton("intructions2");
CardLayout cl = new CardLayout();
panel.setLayout(cl);
start1.addActionListener(e -> cl.previous(panel));
}
class startListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
sent = "Game";
t1.setText("\n\n\n " + sent);
repaint();
}
}
}