We have pageA which has a Jtable and World_info_object "info" . that table shows data from people (people are in world info). I want to edit "info" so each person has an edit button and also this page has a " +NEW " button . These buttons have action listeners : (edit is almost the same)
 newPerson.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent arg0) {
        personFrame=new PersonPage( getInfo() , null );
        Thread closing =new Thread( new Runnable() {
            @Override
            public void run() {
                while(true){
                    if(personFrame.getConfirmed()==true){
                        setWorldInfo(personFrame.getInfo());
                        personFrame.setVisible(false);
                        personFrame.dispose();
                        System.out.println("closed");
                        updateTableData(); // repaint table !
                        break;
                    }
                    System.out.println("open...");
                }   
            }
        }, "closingWindow");
        closing.start();
    }
});
AS you can see here is a thread looks for change in boolean confirmed which I make it true when user press Okay or cancel button in personFrame ! Purpose is to getInfo() from personFrame and set it here in PageA (first frame) and it's done by this but this thread makes " Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 5 >= 5 " .
If some one know how to solve this exception or how should I setdata sent from other page just before closing it please tell me... (Or maybe problem is with table)
Exception : https://i.stack.imgur.com/UnZnd.png
** Update
All I want to do is making pageB from pageA and send info to it (Which is done) and then after confirm or closing pageB run function update(); in pageA ! Any Idea ? :)
**
// ALMOST SOLVED PROGRAM:
public class PageA extends JFrame {
private static HashMap<Integer, String>info=new HashMap<Integer,String>();
private JPanel contentPane;
/**
 * Launch the application.
 */
public static void main(String[] args) {
    info.put(1, "Sofia");
    info.put(2, "XSR");
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                PageA frame = new PageA();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
/**
 * Create the frame.
 */
public PageA() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(80, 80, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    JButton btnNewButton = new JButton("Open pageB");
    btnNewButton.setBounds(126, 11, 160, 23);
    btnNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            final PageB pageB=new PageB(info);
            pageB.addWindowListener(new WindowAdapter(){ // add listener to detect 
                 public void windowClosing(WindowEvent e){
                     setInfo(pageB.getInfo());
                     System.out.println("xxxx");
                 }
             });
        }
    });
    contentPane.add(btnNewButton);
}
public void setInfo(HashMap<Integer, String> uinfo){
    this.info=info;
}
}
public class PageB extends JFrame {
private JPanel contentPane;
private HashMap<Integer, String> info;
public PageB(HashMap<Integer, String> info) {
    this.info=info;
    this.info.put(113, "Alfred");
    this.info.put(314, "Alfa");
    this.info.put(13, "Luter");
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    final PageB that=this;
    JButton btnOkayDone = new JButton("Okay , Done");
    btnOkayDone.setBounds(34, 228, 130, 23);
    btnOkayDone.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            // add event for closing
            that.dispatchEvent(new WindowEvent(that, WindowEvent.WINDOW_CLOSING));
        }
    });
    contentPane.add(btnOkayDone);
    this.setVisible(true);
}
public HashMap<Integer, String> getInfo(){
    return info;
}
}
 
    