title: Button running a whole new class
body: <p>I want my button to run a whole new class that will do different things inside. I don't know if that is even possible cause i'm really bad at java. My code looks like this at the moment:</p>
  
  <pre><code>public class MainMenu {
      private class GardenActivities {
          public GardenActivities() {
              JFrame GardenAct = new JFrame();
              GardenAct.setSize(400, 400);
              GardenAct.setVisible(true);
          }
      }
  
      public static void main(String[] args) {
          JFrame choice = new JFrame();
          choice.setSize(700, 500);
          choice.setLocationRelativeTo(null);
          choice.setTitle("Seeds");
          choice.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JPanel panel = new JPanel();                                                        
          panel.setLayout(new GridLayout(0, 1));
          JButton Labora = new JButton();
          Labora.setText("Laboratory");
          Labora.addActionListener(new ActionListener() {
                  @Override
                  public void actionPerformed(ActionEvent ev) {
                        GardenActivities();
                  }
          });
  
          JButton Garden = new JButton();
          Garden.setText("Garden");
          Garden.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent ev) {
              }
          });
  
          choice.getContentPane().add(panel);
          ButtonGroup group = new ButtonGroup();                                              
          group.add(Garden);
          group.add(Labora);
          panel.add(Garden);
          panel.add(Labora);
          choice.setVisible(true);
      }
  }
  </code></pre>
  
  <p>Just like I said. I need something to run my <code>GardenActivities</code> class just by pressing <code>Garden</code> button.</p>