title: Java: My JFrame's contents (buttons etc.) are not clickable when I start my server
body: <p>I have created a simple HTTP server in Java by using a ServerSocket that accepts browser requests. The server is working fine without any errors. I have created a JForm using Swing that contains buttons to start and stop the server.
  In the start button I have added an ActionListener that runs my ServerMain class.</p>
  
  <pre><code>JButton btnStartServer = new JButton("Start Server");
      panel.add(btnStartServer);
      btnStartServer.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent ae) {
              try {
                  ServerMain.main(new String[0]);
                  } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  </code></pre>
  
  <p>Whenever i start the server though, my JFrame becomes unclickable, and so I cannot click the Exit button which contains this code:</p>
  
  <pre><code>JButton btnExit = new JButton("Exit");
      panel.add(btnExit);
      btnExit.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent ae) {
              try {
                  System.exit(0);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });;
  </code></pre>
  
  <p>The socket listening and accepting for connections through a loop must be the cause of this but I have no idea of how to fix it.
  Any suggestions would be brilliant.
  Thank you in advance :)</p>