title: Java program JButton freezes program after action, need multiple presses
body: <p>I am designing a program that accepts stock ticker symbols and number of shares from the user and I want it to add the information to an ArrayList and once they are done giving input to have it print the list to a text area. I had a general idea of how I wanted this to work coded out, but whenever I would push the button the program would freeze. Also, is there a way to have it print out everything in the arraylist? I have it setup as a for loop which just sets it as the last entered string.</p>
  
  <pre><code>private void GoButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  
  
      String ts1 = tickerSymbol1.getText();
  
      int s1 = Integer.parseInt(shares1.getText());
  
      String site = "http://finance.yahoo.com/d/quotes.csv?s=%22%20"+ts1+"%20+%20%22&amp;f=sl1d1t1c1ohgv&amp;e=.csv";
      try {
          URL stockURL = new URL(site);
          URLConnection data = stockURL.openConnection();
          Scanner input = new Scanner(data.getInputStream());
  
          if (input.hasNext())
  
          while (input.hasNextLine())
          {
              String line = input.nextLine();
              String[] stockinfo = line.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
              total1.setText(stockinfo[1]);
  
  
          }
      } catch (MalformedURLException ex) {
          JOptionPane.showMessageDialog(null, ex);
      } catch (IOException ex) {
          JOptionPane.showMessageDialog(null, ex);
      } 
  
  }                                                                             
  
  private void AddActionPerformed(java.awt.event.ActionEvent evt) {                                    
      ArrayList&lt;String&gt; stocks = new ArrayList&lt;String&gt;();
      String input = tickerSymbol1.getText();
      do { 
          stocks.add(input);
      }while (input.equalsIgnoreCase("quit"));
  
  
              for (int i=0;i&lt;stocks.size();i++)
              {
                  jTextArea1.setText(stocks.get(i));
              }    
  }                                   
  </code></pre>