import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;
public class textFrame extends JFrame {
public textFrame() {
super("Title Frame");
setSize(300, 200);
JLabel username=new JLabel("username: ",SwingConstants.RIGHT);
JLabel passWord=new JLabel("password: ",SwingConstants.RIGHT);
JTextField text=new JTextField(10);
JTextField password=new JTextField(10);
JPanel pane=new JPanel();
pane.setLayout(new GridLayout(2,2));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
String response1 = JOptionPane.showInputDialog(null,
"username:");
String response2=JOptionPane.showInputDialog(null,"passwrod:");
text.setText(response1);
password.setText(response2);
pane.add(username);
pane.add(text);
pane.add(passWord);
pane.add(password);
setContentPane(pane);
setVisible(true);
}
public static void main(String[] arguments) {
JFrame frame = new textFrame();
}
}