title: Java socket server shows blank window
body: <p>I'm writing a program that communcaties two clients through server When I run it without the start method, it works fine and looks like this</p>
  
  <p><img src="https://i.stack.imgur.com/fOimV.jpg" alt=""></p>
  
  <p>but when I try to listen for connections I only get blank white window. The program stops at <code>conn = server.accept()</code> which is quite logical because i dont have a client yet, but why doesn't it how anything?</p>
  
  <hr>
  
  <p>Also, can I get rid of that white border somehow?</p>
  
  <pre><code>import java.awt.*;
  import java.awt.print.PrinterException;
  import java.io.*;
  import java.net.*;
  
  import javax.swing.*;
  
  public class Server extends JFrame {
  private ServerSocket server;
  private Socket conn;
  private JTextArea TA;
  private JPanel panel1;
  private final int port = 1234;
  
  public Server() {
      super("Server");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setSize(new Dimension(400, 300));
      Container c = getContentPane();
      c.setBackground(Color.BLACK);
      TA = new JTextArea();
      TA.setEditable(true);
      TA.setBackground(Color.BLACK);
      TA.setForeground(Color.GREEN);
      c.add(new JScrollPane(TA));
      setVisible(true);
      TA.append("Server started.");
  }
  
  public void start() {
      try {
          TA.append("ServerSocket created. \n Listering for connections...");
          server = new ServerSocket(port, 2);
  
          for (int i = 0; i &lt; 2; i++) {
              conn = server.accept();
              TA.append("User " + i + " connected");
          }
      } catch (IOException ioe) {
          System.out.println(ioe);
      }
  }
  }
  
  import javax.swing.SwingUtilities;
  </code></pre>
  
  <p>`</p>
  
  <pre><code> public class ServerLauncher {
  
  public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable(){
  
          public void run() {
              Server s = new Server();
      //  s.start();
          }
  
      });
  
  }
  
  }
  </code></pre>
  
  <p>i was following a youtube guide to write this, and it gets the same bug but looks like it's discontinued after part 3 so I never found out how to fix it.
  <a href="https://www.youtube.com/watch?v=YqTB-S_5mss" rel="nofollow noreferrer">https://www.youtube.com/watch?v=YqTB-S_5mss</a></p>