import javax.swing.*;
import java.awt.BorderLayout;
import javax.swing.filechooser.*;
public class Second 
{
 		 public static void main(String[] args) 
 		 {
    			JFrame frame = new JFrame("My First Frame");
				// operation to do when the window is closed.
    			frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
				frame.getContentPane().setLayout(new BorderLayout());
    			frame.getContentPane().add(new JLabel("I Love Swing"), BorderLayout.CENTER);
    			frame.pack();        
    			frame.setVisible(true); 
				JFileChooser fc = new JFileChooser();
				int returnVal = fc.showOpenDialog(null);
				if(returnVal == JFileChooser.APPROVE_OPTION)   
				System.out.println("File: " + fc.getSelectedFile());
  		}
}
