-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFemale.java
More file actions
69 lines (50 loc) · 2.03 KB
/
Female.java
File metadata and controls
69 lines (50 loc) · 2.03 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
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class Female extends JFrame {
private static final long serialVersionUID = 1L;
private JLabel jLabel1;
public JTextField txtName;
private JButton btnClick;
private String no;
public Female(Pokemon male,ArrayList<Pokemon> female,ArrayList<Pokemon> bag){
super("Female Pokemon");
jLabel1 = new JLabel();
txtName = new JTextField();
btnClick = new JButton();
//setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
jLabel1.setText("Female Pokemon Number");
getContentPane().add(jLabel1);
jLabel1.setBounds(140, 60, 180, 18);
txtName.setName("txtName");
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 < female.size() ; i++){
if(result == i){
Pokemon females = female.get(i);
new Hatching(male, females, bag);
System.out.println(females);
}
}
} catch (NumberFormatException evt) {
new Female(male, female, bag);
}
setVisible(false);
}
});
getContentPane().add(btnClick);
btnClick.setBounds(160, 140, 90, 23);
setSize(400, 300);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}