-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHatching2.java
More file actions
159 lines (132 loc) · 5.63 KB
/
Hatching2.java
File metadata and controls
159 lines (132 loc) · 5.63 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class Hatching3 extends JFrame{
private static final long serialVersionUID = 1L;
public Hatching3(Pokemon male,Pokemon female,ArrayList<Pokemon> partners) {
super("Hatch Pokemon Egg");
ArrayList<Pokemon> pokemons = new ArrayList<Pokemon>();
//System.out.println(partners);
Font myFont2 = null;
try{
myFont2 = Font.createFont ( Font.TRUETYPE_FONT, new FileInputStream ( "font2/Pokemon Solid.ttf" ) );
}catch ( FontFormatException error ){
}catch ( FileNotFoundException error ){
}catch ( IOException error ){
}
Container c = getContentPane();
JLabel j1 = new JLabel(new ImageIcon(""));;
if(male.getType() == "Electric" || female.getType() == "Electric" ){
for(int i =0 ; i < 1 ;++i){
int type = (int)(Math.random()*3);
if(type == 0){
pokemons.add(new Electabuzz("Electabuzz","Electric"));
j1 = new JLabel(new ImageIcon("img/electabuzz.jpg"));
}
if(type == 1){
pokemons.add(new Voltorb("Voltorb","Electric"));
j1 = new JLabel(new ImageIcon("img/voltorb.jpg"));
}
if(type == 2){
pokemons.add(new Pichu("Pichu","Electric"));
j1 = new JLabel(new ImageIcon("img/pichu.jpg"));
}
}
}
if(male.getType() == "Water" || female.getType() == "Water"){
for(int i =0 ; i < 1 ;++i){
int type = (int)(Math.random()*3);
if(type == 0){
pokemons.add(new Sobble("Sobble","Water"));
j1 = new JLabel(new ImageIcon("img/sobble.jpg"));
}
if(type == 1){
pokemons.add(new Drednaw("Drednaw","Water"));
j1 = new JLabel(new ImageIcon("img/drednaw.jpg"));
}
if(type == 2){
pokemons.add(new Krabby("Krabby","Water"));
j1 = new JLabel(new ImageIcon("img/krabby.jpg"));
}
}
}
if(male.getType() == "Grass" || female.getType() == "Grass"){
for(int i =0 ; i < 1 ;++i){
int type = (int)(Math.random()*3);
if(type == 0){
pokemons.add(new Shiftry("Shiftry","Grass"));
j1 = new JLabel(new ImageIcon("img/shiftry.jpg"));
}
if(type == 1){
pokemons.add(new Lombre("Lombre","Grass"));
j1 = new JLabel(new ImageIcon("img/lombre.jpg"));
}
if(type == 2){
pokemons.add(new Grookey("Grookey","Grass"));
j1 = new JLabel(new ImageIcon("img/grookey.jpg"));
}
}
}
if(male.getType() == "Normal" || female.getType() == "Normal" ){
for(int i =0 ; i < 1 ;++i){
int type = (int)(Math.random()*3);
if(type == 0){
pokemons.add(new Kangaskhan("Kangaskhan","Normal"));
j1 = new JLabel(new ImageIcon("img/kangaskhan.jpg"));
}
if(type == 1){
pokemons.add(new Eevee("Eevee","Normal"));
j1 = new JLabel(new ImageIcon("img/eevee.jpg"));
}
if(type == 2){
pokemons.add(new Jigglypuff("Jigglypuff","Normal"));
j1 = new JLabel(new ImageIcon("img/jigglypuff.jpg"));
}
}
}
if(pokemons.size() > 1){
for(int i = 0 ;i < 1 ; i++){
int t = (int)(Math.random()*2);
if(t == 0){
Pokemon p = pokemons.get(0);
//partners.add(p);
MyName m = new MyName(p, partners);
m.playgui(p, partners);
}
else if(t == 1){
Pokemon p = pokemons.get(1);
//partners.add(p);
MyName m = new MyName(p, partners);
m.playgui(p, partners);
}
}
}
j1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JPanel pk1 = new JPanel();
JLabel k1 = new JLabel("MY EGG", JLabel.CENTER);
k1.setFont(myFont2.deriveFont(Font.BOLD,40f));
k1.setForeground(Color.PINK);
k1.setBackground(Color.YELLOW);
pk1.add(k1);
JButton b1 = new JButton("OK");
b1.add(Box.createRigidArea(new Dimension(245, 25)));
b1.setFont(b1.getFont().deriveFont(Font.ITALIC,18.0f));
b1.addActionListener(new ActionListener(){
//anonymous class
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
c.add(pk1, BorderLayout.NORTH);
c.add(j1, BorderLayout.CENTER);
c.add(b1, BorderLayout.SOUTH);
Bag.bag = partners;
setSize(600, 450);
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}