title: How do i use a gui i build together with functions from somewhere else?
body: <p>Hello im new here i am making a small tictactoe game where i have made a gui as follows:</p>
  
  <pre><code>public static void main(String[] args) {
  
      Frame frame1 =new Frame("TickTacToe");
      frame1.setLayout(null);
      frame1.setBounds(250,150,500,500);
      frame1.setVisible(true);
      frame1.addWindowListener(new WindowAdapter(){
          public void windowClosing(WindowEvent e){
              System.exit(0);
          }
      });
  
      final Button button11 = new Button("");
      button11.addActionListener(null);
  
      final Button button12 = new Button("");
      button11.addActionListener(null);
  
      final Button button13 = new Button("");
      button11.addActionListener(null);
  
      final Button button21 = new Button("");
      button11.addActionListener(null);
  
      final Button button22 = new Button("");
      button11.addActionListener(null);
  
      final Button button23 = new Button("");
      button11.addActionListener(null);
  
      final Button button31 = new Button("");
      button11.addActionListener(null);
  
      final Button button32 = new Button("");
      button11.addActionListener(null);
  
      final Button button33 = new Button("");
      button11.addActionListener(null);
  
  
      button11.setBounds(100, 100, 80, 70);
      button12.setBounds(100, 200, 80, 70);
      button13.setBounds(100, 300, 80, 70);
      button21.setBounds(200, 100, 80, 70);
      button22.setBounds(200, 200, 80, 70);
      button23.setBounds(200, 300, 80, 70);
      button31.setBounds(300, 100, 80, 70);
      button32.setBounds(300, 200, 80, 70);
      button33.setBounds(300, 300, 80, 70);
  
      frame1.add(button11); 
      frame1.add(button12); 
      frame1.add(button13); 
      frame1.add(button21); 
      frame1.add(button22); 
      frame1.add(button23); 
      frame1.add(button31); 
      frame1.add(button32);
      frame1.add(button33); 
  }
  </code></pre>
  
  <p>I want to add action listeners to the buttons but not in this void ideall even a different class so i can create a way to run a loop of functions such as a player turn changer where if it is turn one it will set button text to x and o if it is the otheI know more orless the code i would need to use but i cant figure out a way to use the gui from anzwhere else than its own void. I dont quite know what im searching for so any help is much appreciated.</p>