-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyFrame2.java
More file actions
31 lines (24 loc) · 831 Bytes
/
MyFrame2.java
File metadata and controls
31 lines (24 loc) · 831 Bytes
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
import java.awt.EventQueue;
import java.awt.GridLayout;
import javax.swing.*;
public class MyFrame2{
public static String output;
public static void display(){
JTextField field1 = new JTextField();
JTextField field2 = new JPasswordField();
JPanel panel = new JPanel(new GridLayout(0, 1));
panel.add(new JLabel("Check The registered mail for OTP "));
panel.add(new JLabel("Enter the OTP"));
panel.add(field1);
int result = JOptionPane.showConfirmDialog(null, panel, "Test",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (result == JOptionPane.OK_OPTION) {
output = field1.getText();
} else {
System.out.println("Cancelled");
}
}
public static String getOutput(){
return output;
}
}