import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

/**
 * This example shows JFileChooser, ActionListener,
 * and JOptionPane.  It also shows how to pass a 2D array
 * as a parameter to a method.
 */
public class Example implements ActionListener {
 
  private int[][] ourList;
  
  public Example(int[][] list) {
    ourList = list;  
    JFileChooser chooser = new JFileChooser("C:\\");
    chooser.showOpenDialog(null);
      
    if (JFileChooser.APPROVE_OPTION != 0) {
      File f = chooser.getSelectedFile();
      String filename = f.toString();
      JOptionPane.showMessageDialog(null, filename);
    }
  }
  
  public void myButtonExample() {
    JFrame j = new JFrame();
    JButton b = new JButton("hello");
    b.addActionListener(this);
    Container c = j.getContentPane();
    c.add(b);
    j.pack();
    j.show();
  }
  
  public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    
    button.setText("Bye");
  }
    
}
