-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatusPokemon.java
More file actions
132 lines (90 loc) · 3.99 KB
/
StatusPokemon.java
File metadata and controls
132 lines (90 loc) · 3.99 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
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;
public class StatusPokemon extends JFrame {
private static final long serialVersionUID = 1L;
private static int i = 0;
public StatusPokemon(ArrayList<Pokemon> p) {
super("POKEMON");
Container c = getContentPane();
JPanel p1 = new JPanel();
JPanel p2 = new JPanel();
try {
Pokemon partners = p.get(i);
p1.setBorder(BorderFactory.createEmptyBorder(70, 15, 15, 10));
p2.setBorder(BorderFactory.createEmptyBorder(70, 15, 50, 100));
p1.setLayout(new BoxLayout(p1, BoxLayout.Y_AXIS));
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS));
JLabel b0 = new JLabel("Number : " + i);
JLabel b1 = new JLabel("Name : " + partners.getMyName());
JLabel b2 = new JLabel("Pokemon : " + partners.getName());
JLabel b5 = new JLabel("HP : " + partners.getHP());
JLabel b6 = new JLabel("PP : " + partners.getPP());
JLabel b7 = new JLabel("Gender : " + partners.getGen());
p1.add(b0);
p1.add(b1);
p1.add(b2);
p2.add(b5);
p2.add(b6);
p2.add(b7);
JLabel j1 = new JLabel(new ImageIcon(""));;
if(partners.getName() == "Lapras"|| partners.getName() == "Wild Lapras"){
j1 = new JLabel(new ImageIcon("img/Lapras.gif"));
}
else if(partners.getName() == "Snorlax" || partners.getName() == "Wild Snorlax" ){
j1 = new JLabel(new ImageIcon("img/Snorlax.gif"));
}
else if(partners.getName() == "Lucario" || partners.getName() == "Wild Lucario"){
j1 = new JLabel(new ImageIcon("img/Lucario.gif"));
}
else if (partners.getName() == "Riolu" || partners.getName() == "Wild Riolu"){
j1 = new JLabel(new ImageIcon("img/Riolu.gif"));
}
else if (partners.getName() == "Giratina" || partners.getName() == "Wild Giratina"){
j1 = new JLabel(new ImageIcon("img/Giratina.gif"));
}
j1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
c.add(j1, BorderLayout.WEST);
} catch (NullPointerException e) {
}
JPanel p3 = new JPanel();
p3.setBorder(BorderFactory.createEmptyBorder(10, 265, 15, 10));
p3.setLayout(new BoxLayout(p3, BoxLayout.X_AXIS));
JButton button1 = new JButton("Next");
p3.add(button1);
button1.add(Box.createRigidArea(new Dimension(40, 18)));
p3.add(Box.createRigidArea(new Dimension(30, 0)));
JButton button2 = new JButton("Back");
p3.add(button2);
button2.add(Box.createRigidArea(new Dimension(40, 18)));
button2.addActionListener(new ActionListener(){
//anonymous class
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
button1.addActionListener(new ActionListener(){
//anonymous class
public void actionPerformed(ActionEvent e) {
i++;
try {
new StatusPokemon(p);
setVisible(false);
} catch (IndexOutOfBoundsException t) {
i = 0;
new StatusPokemon(p);
setVisible(false);
//t.getMessage();
}
}
});
c.add(p1, BorderLayout.CENTER);
c.add(p2, BorderLayout.EAST);
c.add(p3, BorderLayout.SOUTH);
setSize(720, 350);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setResizable(false);
}
}