import javax.swing.*;import java.awt.event.*;
class GUIAppwithInner 
{		JFrame f;
		JLabel l1, l2;
		JTextField t1,t2;
		JButton b1;	JPanel p;
	public GUIAppwithInner()
	{
		f=new JFrame("My First GUI App");
		l1=new JLabel("First Name");
		l2=new JLabel("Last  Name");
		t1=new JTextField(20);
		t2=new JTextField(20);
		b1=new JButton("Swap");
		p=new JPanel();
		p.add(l1); p.add(t1);
		p.add(l2); p.add(t2); p.add(b1);
		MyListenerInnerClass x=new MyListenerInnerClass();
		b1.addActionListener(x);
		f.getContentPane().add(p);
		f.setSize(200,300);
		f.setVisible(true);
	}
	public static void main(String s[])
	{
		new GUIAppwithInner();
	}
	class MyListenerInnerClass implements ActionListener
	{
	public void actionPerformed(ActionEvent e)
	{	Object obj=e.getSource();
		if(obj==b1)
		{
		String s1=t1.getText();	String s2=t2.getText();
		t2.setText(s1);	t1.setText(s2);
		}
	}}}