
Design an appliaction for with details such as name,age,DOB,address,qualification and finaly when we click the view details button all types details should be displayed in another View in TextView's..I need the sample code..

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Form extends JFrame
{
JButton ADD;
JPanel panel;
JLabel label1,label2;
final JTextField text1,text2;;
Form(){
label1 = new JLabel();
label1.setText("Name:");
text1 = new JTextField(20);
label2 = new JLabel();
label2.setText("Address:");
text2 = new JTextField(20);
ADD=new JButton("View");
panel=new JPanel(new GridLayout(3,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(ADD);
add(panel);
setTitle("FORM");
ADD.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String value1=text1.getText();
String value2=text2.getText();
JFrame f=new JFrame();
JPanel p=new JPanel(new GridLayout(2,2));
JLabel l1=new JLabel("Name");
JTextField t1 = new JTextField(20);
JLabel l2=new JLabel("Address");
JTextField t2 = new JTextField(20);
t1.setText(value1);
t2.setText(value2);
p.add(l1);
p.add(t1);
p.add(l2);
p.add(t2);
f.add(p);
f.setVisible(true);
f.pack();
}
});
}
}
class FormDemo
{
public static void main(String arg[])
{
try
{
Form frame=new Form();
frame.pack();
frame.setVisible(true);
}
catch(Exception e)
{
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.