import java.awt.*;
import java.awt.event.*;

public class DataEntry {
  public static void main(String[] args) {
  Frame frm=new Frame("DataEntry frame");
  Label lbl = new Label("Please fill this blank:");
  frm.add(lbl);
  frm.setSize(350,200);
  frm.setVisible(true);
  frm.addWindowListener(new WindowAdapter(){
  public void windowClosing(WindowEvent e){
  System.exit(0);
  }
  });
  Panel p = new Panel();
  Panel p1 = new Panel();
  Label jFirstName = new Label("First Name");
  TextField lFirstName = new TextField(20);
  Label jLastName =new Label("Last Name");
  TextField lLastName=new TextField(20);
  p.setLayout(new GridLayout(3,1));
  p.add(jFirstName);
  p.add(lFirstName);
  p.add(jLastName);
  p.add(lLastName);
  Button Submit=new Button("Submit");
  p.add(Submit);
  p1.add(p);
  frm.add(p1,BorderLayout.NORTH);
  }
}

HOw we will display the name and last name in another window

@Zwinky: is this your response to the OP's question, or is it a new question?
in both cases, you shouldn't have posted it here.

this thread hasn't been open in several years, so the chance of the OP coming back to read your post is as good as nill.

if it is, what I think it is, an actual new question, you start a new thread.
you would do that by opening another JFrame and sending the data as parameters (for instance)

but a quick hint: keep your main method short and simple.

don't go creating JFrames in there, do that in a seperate class