title: Displaying text with JFrame
body: <p>I'm trying to make a simple counter but the window that appears doesn't show anything at all. Not sure what I'm doing wrong but I feel like it has something to do with the output String not properly updating. Any insights would be greatly appreciated. Can only be wrong after all.</p>
  
  <pre><code>import java.util.Random;
  
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  
  public class main {
  
  public static int counter = 0;
  public static int end = 100;
  public static String output;
  
  public static void main (String[] args){
      window();
  }
  public static void window(){
      JLabel label = new JLabel(output, JLabel.CENTER);
      label.setAlignmentX(0);
      label.setAlignmentY(0);
  
      JFrame window = new JFrame("");
      window.setVisible(true);
      window.setSize(500,500);
      window.add(label);
  }
  
  public static void counter(String counter1) throws InterruptedException{
  
      Random rand = new Random();
  
      int start = 0;
  
      for(int i =0; i &lt; end; i++){
          int random = rand.nextInt(60) + 1;
          start ++;
  
          if (start != 0){
  
              for(int z =0; z &lt;= random; z++){
                  counter ++;
                  System.out.print(counter);
                  Thread.sleep(1000);
              }
          }
          counter = 0;
          start = 0;
      }
  }
  </code></pre>