-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyPokemon.java
More file actions
100 lines (69 loc) · 3 KB
/
MyPokemon.java
File metadata and controls
100 lines (69 loc) · 3 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
import javax.swing.*;
import java.util.*;
import java.awt.event.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.awt.*;
public class MyPokemon extends JFrame {
private static final long serialVersionUID = 1L;
private ArrayList<Pokemon> bag;
public MyPokemon(Pokemon wildPokemon,ArrayList<Ball> ball){
super("Catch Wild Pokemon ");
Container c = getContentPane();
//System.out.println(wildPokemon);
//System.out.println(Trainer.bag);
bag = new ArrayList<Pokemon>();
for(Pokemon a : PersonalTrainer.bag ){
bag.add(a);
}
Font myFont = null;
try{
myFont = Font.createFont ( Font.TRUETYPE_FONT, new FileInputStream ( "font3/LmsPokedex-XEja.ttf" ) );
}catch ( FontFormatException error ){
}catch ( FileNotFoundException error ){
}catch ( IOException error ){
}
JPanel head = new JPanel();
JLabel k1 = new JLabel("Select my Pokemon ", JLabel.CENTER);
head.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
k1.setFont(myFont.deriveFont(Font.BOLD,20f));
k1.setForeground(Color.RED);
head.add(k1);
JPanel radio2 = new JPanel();
ButtonGroup group2 = new ButtonGroup();
radio2.setBorder(BorderFactory.createEmptyBorder(20, 60, 10, 10));
radio2.setLayout(new BoxLayout(radio2, BoxLayout.Y_AXIS));
JPanel button = new JPanel();
JButton btn = new JButton("SELECT");
for(int i = 0 ; i < bag.size() ; ++i ){
radio2.add(new JRadioButton(""+ i + " " + bag.get(i),false));
group2.add(new JRadioButton(""+ i + " " + bag.get(i),false));
}
button.setLayout(new BoxLayout(button, BoxLayout.X_AXIS));
btn.add(Box.createRigidArea(new Dimension(240, 20)));
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Mine m = new Mine(wildPokemon,bag,ball);
m.playgui(wildPokemon,bag,ball);
//setVisible(false);
}
});
JButton btn2 = new JButton("CANCEL");
btn2.add(Box.createRigidArea(new Dimension(240, 20)));
btn2.addActionListener(new ActionListener(){
//anonymous class
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
button.add(btn);
button.add(btn2);
c.add(button, BorderLayout.SOUTH);
c.add(radio2, BorderLayout.WEST);
c.add(head, BorderLayout.NORTH);
setSize(550, 350);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}