-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlevelflower.java
135 lines (119 loc) · 4.36 KB
/
levelflower.java
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
public class levelflower extends JFrame {
private static JFrame level;
private static int b = 0;
public static void easyFlower() {
FlowersEasy obj = new FlowersEasy();
// obj.setVisible(true);
level.dispose();
}
public static void mediumFlower() {
FlowersMedium obj = new FlowersMedium();
// obj.setVisible(true);
level.dispose();
}
public static void hardFlower() {
FlowersHard obj = new FlowersHard();
// obj.setVisible(true);
level.dispose();
}
public static void easyInfo() {
JOptionPane.showMessageDialog(level, "You have 6 Chances to win the game otherwise your man will be hanged",
"Easy Rules", JOptionPane.INFORMATION_MESSAGE);
}
public static void mediumInfo() {
JOptionPane.showMessageDialog(level, "You have 5 Chances to win the game otherwise your man will be hanged",
"Medium Rules", JOptionPane.INFORMATION_MESSAGE);
}
public static void hardInfo() {
b++;
if (b < 3) {
JOptionPane.showMessageDialog(level, "You have 4 Chances to win the game otherwise your man will be hanged",
"Hard Rules",
JOptionPane.INFORMATION_MESSAGE);
} else {
Nightmare obj = new Nightmare();
level.dispose();
}
}
public levelflower() {
level = new JFrame();
level.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
level.setSize(300, 350);
level.setResizable(false);
level.setTitle("LEVELS");
level.setLayout(null);
JLabel head = new JLabel("<html>Choose the level<br>of difficulty.</html>");
head.setFont(new Font("Arial", Font.PLAIN, 25));
head.setBounds(50, 10, 200, 50);
level.add(head);
ImageIcon photo1 = new ImageIcon("images\\easy.png");
JButton button1 = new JButton(photo1);
button1.setBounds(70, 90, 100, 50);
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
easyFlower();
}
});
level.add(button1);
ImageIcon photo2 = new ImageIcon("images\\medium.png");
JButton button2 = new JButton(photo2);
button2.setBounds(70, 150, 100, 50);
button2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mediumFlower();
}
});
level.add(button2);
ImageIcon photo3 = new ImageIcon("images\\hard.png");
JButton button3 = new JButton(photo3);
button3.setBounds(70, 210, 100, 50);
button3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hardFlower();
}
});
level.add(button3);
ImageIcon photo4 = new ImageIcon("images\\desc.png");
JButton desc1 = new JButton(photo4);
JButton desc2 = new JButton(photo4);
JButton desc3 = new JButton(photo4);
desc1.setBounds(190, 90, 70, 50);
desc1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
easyInfo();
}
});
desc2.setBounds(190, 150, 70, 50);
desc2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mediumInfo();
}
});
desc3.setBounds(190, 210, 70, 50);
desc3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hardInfo();
}
});
level.add(desc1);
level.add(desc2);
level.add(desc3);
level.getContentPane().setBackground(Color.decode("#E7FFFF"));
level.setVisible(true);
}
}