-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBkashpin.java
More file actions
168 lines (129 loc) · 5.16 KB
/
Bkashpin.java
File metadata and controls
168 lines (129 loc) · 5.16 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
160
161
162
163
164
165
166
167
168
import java.awt.*;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import javax.swing.*;
import javax.swing.ImageIcon;
public class Bkashpin extends JFrame {
private JLabel Amount;
private JButton closebutton;
private JPasswordField pin;
public static JLabel AmountNumber;
public static JLabel no;
private JCheckBox jCheckBox1;
private JLabel jLabel1;
private JLabel marchant;
private JLabel marchantname;
private JLabel error;
private JButton probutton;
private JLabel word;
private JLabel box;
private Container c;
private JLabel name;
public Bkashpin() {
error=new JLabel();
name=new JLabel();
jCheckBox1 = new JCheckBox();
probutton = new JButton();
closebutton = new JButton();
pin = new JPasswordField();
marchant = new JLabel();
marchantname = new JLabel();
Amount = new JLabel();
AmountNumber = new JLabel();
word = new JLabel();
jLabel1 = new JLabel();
box = new JLabel();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(null);
c=this.getContentPane();
c.setBackground(Color.red);
error.setBounds(230,550,100,30);
add(error);
name.setBounds(250,100,200,30);
name.setText("bkash");
name.setFont(new Font("Arial", Font.BOLD, 38));
add(name);
probutton.setFont(new Font("Inter", Font.PLAIN, 14));
probutton.setText("PROCEED");
add(probutton);
probutton.setBounds(150, 630, 130,25);
probutton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
String password = new String(pin.getPassword());
String fileData = "";
boolean validCredentials = false;
try {
File file = new File("F:\\code\\StudentManagement\\src\\Registration.txt");
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
fileData += scanner.nextLine() + "\n";
}
scanner.close();
// Check if username and password match any registration data
if (fileData.contains("Pin: " + password) && fileData.contains("Number: " + PaymentOperation.no.getText())) {
validCredentials = true;
}
} catch (FileNotFoundException ex) {
System.out.println("File not found: " + ex.getMessage());
}
if (validCredentials) {
Bkashotp b=new Bkashotp();
b.AmountNumber.setText(Bkashpin.AmountNumber.getText());
b.setVisible(true);
setVisible(false);
}
else{
error.setText("Invalid Pin");
}
}});
closebutton.setFont(new Font("Inter", Font.PLAIN, 14));
closebutton.setText("CLOSE");
add(closebutton);
closebutton.setBounds(330, 630, 100, 25);
closebutton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
System.exit(0);
}});
add(pin);
pin.setBounds(175, 520, 200, 30);
marchant.setFont(new Font("Inter", Font.BOLD, 14));
marchant.setForeground(new Color(255, 255, 255));
marchant.setText("Merchant :");
add(marchant);
marchant.setBounds(160, 210, 120, 30);
// marchantname.setFont(new Font("Inter", Font.BOLD, 14));
marchantname.setForeground(new Color(255, 255, 255));
marchantname.setText("American International School");
add(marchantname);
marchantname.setBounds(290, 220, 190, 18);
Amount.setFont(new Font("Inter", Font.BOLD, 14));
Amount.setForeground(new Color(255, 255, 255));
Amount.setText("Amount :");
add(Amount);
Amount.setBounds(160, 260, 120, 18);
AmountNumber.setFont(new Font("Inter", Font.BOLD, 14));
AmountNumber.setForeground(new Color(255, 255, 255));
add(AmountNumber);
AmountNumber.setBounds(300, 260, 100, 18);
word.setFont(new Font("Inter", Font.BOLD, 14));
word.setForeground(new Color(255, 255, 255));
word.setText("Enter your PIN ");
add(word);
word.setBounds(210, 465, 210, 40);
jLabel1.setIcon(new ImageIcon("C:\\Users\\DP\\Desktop\\New folder (12)\\static\\bKashPayment_bg .png"));
add(jLabel1);
jLabel1.setBounds(0, 0, 600, 800);
pack();
setSize(615, 800);
setResizable(false);
setVisible(true);
setLocationRelativeTo(null);
}
public static void main(String args[]) {
new Bkashpin();
}
}