title: Connecting 2 different programs in Java (each one has its main method)
body: <p>I have created 2 programs (Background and NrLojtareve) using Java GUI where each one of them creates a step of a game.  Each program has its own main method.</p>
  
  <p>All I want to do is after executing the first program (NrLojtareve) which includes 4 radio buttons to display the other page, I created with the other program(Background).</p>
  
  <p>So going from the first step of the game to the second.  So the handler of NrLojtareve class to call the Background class.</p>
  
  <p>Can anyone show me how to call the second program from the first or how to display the second GUI after selecting a radio button from the first program?</p>
  
  <p><br/>
  Here is the code.</p>
  
  <p><strong>Nrlojtareve.java</strong></p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  import javax.swing.event.*;
  import javax.swing.*;
  
  public class Nrlojtareve extends JFrame {
  
      private JRadioButton a;
      private JRadioButton b;
      private JRadioButton c;
      private JRadioButton d;
      private ButtonGroup group ;
      private JLabel e;
  
      public Nrlojtareve() {
          setLayout(new FlowLayout());
          a=new JRadioButton("1");
          b=new JRadioButton("2");
          c=new JRadioButton("3");
          d=new JRadioButton("4");
          e=new JLabel("Choose the number of players!");
          add(a);
          add(b);
          add(c);
          add(d);
          add(e);
          group = new ButtonGroup();
          group.add(a);
          group.add(b);
          group.add(c);
          group.add(d);
  
          thehandler hand = new thehandler();
          a.addItemListener(hand);
          b.addItemListener(hand);
          c.addItemListener(hand);
          d.addItemListener(hand);
      }
  
      private class thehandler implements ItemListener {
          public void itemStateChanged(ItemEvent event) {
  
          }
      }
  
      public static void main(String[] args) {
  
          Nrlojtareve elda = new Nrlojtareve();
          elda.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          elda.setSize(300,400);
          elda.setVisible(true);
      }
  
  }
  </code></pre>
  
  <p><br/>
  <strong>Back.java</strong></p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  import javax.swing.event.*;
  import javax.swing.*;
  import java.util.Random;
  
  public class Back extends JFrame {
  
  private Container pane;
      public Back() {
          super("title");
          setLayout(null);
  
          Icon i=new ImageIcon(getClass().getResource("1.png"));
          pane=new Container();
  
          //konstruktori i handler merr nje instance te Background
          thehandler hand = new thehandler();
  
      }
  
       private class thehandler implements ActionListener {
  
           public void actionPerformed(ActionEvent event) {
  
           }
      }
      public static void main(String[] args) {
  
           Back  d = new Back() ;
  
           d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           d.getContentPane().setBackground(Color.GREEN);
           d.setSize(700,500);
  
           d.setVisible(true);    
      }
  }
  </code></pre>