I am try to learn java. I create architecture but i dont know how can i send data with two form here is my source code...
This part wich is table and buttons;
package main;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
public class Form1 extends JFrame implements ActionListener 
{
   JButton button = new JButton("Open form");
   public Form1(){
      String[] column = {"Name", "Surname"};
      Object[][] data ={};
      DefaultTableModel model = new DefaultTableModel(data, column);
      JTable table = new JTable(model);
      JScrollPane pane = new JScrollPane(table);
      JFrame frame = new JFrame();
      button.setBounds(150, 300, 80, 35);
      pane.setBounds(150, 200, 150, 80);
      frame.add(pane);
      frame.add(button);
      frame.setLayout(null);
      frame.setTitle("Form1");
      frame.setResizable(false);
      frame.setSize(450,380);
      frame.setLocationRelativeTo(null);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true); 
      button.addActionListener(this);
   }
   public void actionPerformed (ActionEvent action){
      if(action.getSource() == button )
      {
         Form2 f2 = new Form2();
         dispose();
      }
   } 
   public static void main(String[] args) {
      Form1 f1 = new Form1();
   }  
}
I want to get values from to this form;
package main;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
public class Form2 extends JFrame implements ActionListener{
   JTextField txt = new JTextField(10);
   JTextField txt2 = new JTextField(10);
   JButton addButton = new JButton("add");
   public Form2(){
      JFrame frame = new JFrame();
      txt.setBounds(20, 50, 80, 22);
      txt2.setBounds(20, 100, 80, 22);
      addButton.setBounds(20, 150, 80, 30);
      frame.add(txt);
      frame.add(txt2);
      frame.add(addButton);
      frame.setLayout(null);
      frame.setTitle("Form2");
      frame.setResizable(false);
      frame.setSize(450,380);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      addButton.addActionListener(this);    
   }
   public void actionPerformed (ActionEvent action){
      if(action.getSource() == addButton){
         String Name= this.txt.getText();
         String Surname= this.txt2.getText();
         //DefaultTableModel model = (DefaultTableModel) Form1.table.getModel();
         Object[] row = {Name, Surname};
         Form1 f1 = new Form1();
         dispose();
      }
   }  
}
I check the tutorials and other youtube channels and no one doesnt like this can you give me one refrenece to learn with tutorial or examples.
