-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMale.java
More file actions
73 lines (54 loc) · 2.08 KB
/
Male.java
File metadata and controls
73 lines (54 loc) · 2.08 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
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class Male extends JFrame {
private static final long serialVersionUID = 1L;
private JLabel jLabel1;
public JTextField txtName;
private JButton btnClick;
private String no;
private ArrayList<Pokemon> bag;
public Male(ArrayList<Pokemon> male,ArrayList<Pokemon> female,ArrayList<Pokemon> bags){
super("Male Pokemon");
jLabel1 = new JLabel();
txtName = new JTextField();
btnClick = new JButton();
System.out.println(bag);
bag = new ArrayList<Pokemon>();
for(Pokemon b : male){
bag.add(b);
}
getContentPane().setLayout(null);
jLabel1.setText("Male Pokemon Number");
getContentPane().add(jLabel1);
jLabel1.setBounds(140, 60, 160, 18);
txtName.setName("txtName"); // NOI18N
txtName.setSize(180, 150);
getContentPane().add(txtName);
txtName.setBounds(80, 100, 260, 20);
btnClick.setText("Click");
btnClick.addActionListener(new ActionListener(){
//anonymous class
public void actionPerformed(ActionEvent e) {
try {
no = txtName.getText();
int result = Integer.parseInt(no);
for(int i = 0; i < male.size() ; i++){
if(result == i){
Pokemon males = male.get(i);
new Female(males,female,bags);
}
}
} catch (NumberFormatException evt) {
new Male(male, female, bags);
}
setVisible(false);
}
});
getContentPane().add(btnClick);
btnClick.setBounds(160, 140, 90, 23);
setSize(400, 300);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}