-
Notifications
You must be signed in to change notification settings - Fork 0
/
MobilePayGUI.java
56 lines (44 loc) · 1.54 KB
/
MobilePayGUI.java
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
package park;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MobilePayGUI extends JFrame implements ActionListener {
private JLabel emailLabel, passwordLabel, otpLabel;
private JTextField emailField, passwordField, otpField;
private JButton payButton;
public MobilePayGUI() {
super("Mobile Pay GUI");
// Set layout for the frame
setLayout(new GridLayout(4, 2));
// Create and add components to the frame
emailLabel = new JLabel("Email ID:");
emailField = new JTextField();
passwordLabel = new JLabel("Password:");
passwordField = new JPasswordField();
otpLabel = new JLabel("OTP:");
otpField = new JTextField();
payButton = new JButton("Pay");
add(emailLabel);
add(emailField);
add(passwordLabel);
add(passwordField);
add(otpLabel);
add(otpField);
add(new JLabel());
add(payButton);
// Add action listener to the pay button
payButton.addActionListener(this);
// Set the size and visibility of the frame
setSize(400, 200);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
// Implement actionPerformed method for ActionListener interface
public void actionPerformed(ActionEvent e) {
if (e.getSource() == payButton) {
// Add code to process payment here
JOptionPane.showMessageDialog(null, "Payment successful!");
dispose();
}
}
}