Can not add a picture to the JFrame from an ActionListener class

As topic says, I can not add a picture to the JFrame from an ActionListener class which is a class inside the JFrame class.
I have a Map.java class where I load an image with ImageIcon chosen with JFileChooser.
I my window class (main class), I have following:
class OpenImage_Listener implements ActionListener
     public void actionPerformed(ActionEvent e)
          int ans = open.showOpenDialog(MainProgram.this);     // "open" is the JFileChooser reference
          if(ans == open.APPROVE_OPTION)
               File file = open.getSelectedFile();                    
               MainProgram.this.add(new Map(file.getName()), BorderLayout.CENTER);     // this line does not work - it does not add the choosen picture on the window,
                        //but if I add the picture outside this listener class and inside the MainProgram constructor, the picture apperas, but then I cannot use the JFileChooser.
                        showMessageDialog(MainProgram.this, fil.getName() ,"It works", INFORMATION_MESSAGE);  // this popup works, and thereby the ActionListener also works.
}So why can�t I add a picture to the window from the above listener class?
Advertisement
Reply

The SSCCE:
Ok, I think I solved it with the picture, but now I cannot add new components after adding the picture.
Look at the comment in the actionlistener class:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class Test extends JFrame{
     JButton b = new JButton("Open");
     JFileChooser jfc = new JFileChooser(System.getProperty("user.dir"));
     Picture pane;
     Test(){
          super("Main Program");
          setLayout(new BorderLayout());
          JPanel north = new JPanel();
          add(north, BorderLayout.NORTH);
          north.add(b);
          b.addActionListener(new Listener());
          setVisible(true);
          setSize(500,500);
          pane = new Picture("");
          add(pane, BorderLayout.CENTER);
     class Listener implements ActionListener {
          public void actionPerformed(ActionEvent e){
               int ans = jfc.showOpenDialog(Test.this);
               if(ans == jfc.APPROVE_OPTION)
                    File file = jfc.getSelectedFile();
                    Test.this.add(new Picture(file.getName()), BorderLayout.CENTER);
                    pane.add(new JButton("NEW BUTTON")); // Why does this button not appear on the window???
                    pane.repaint();
                    pane.revalidate();
     public static void main(String[] args)
          Test t = new Test();
class Picture extends JPanel
     Image pic;
     String filename;
     Picture(String filename)
          setLayout(null);
          this.filename = filename;
          pic = Toolkit.getDefaultToolkit().getImage(filename);
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            g.drawImage(pic,0,0,getWidth(),getHeight(),this);
            revalidate();
}