title: How to show a arraylist of string on jlabel?
body: <p>Hi I have an arraylist of strings, I want to show the content of the arraylist on JLabel separated by a space or comma. But it shows me only one String, the last one.</p>
  
  <pre><code> public void ShowMovie(int idMovie) throws SQLException, IOException {
          int ID = idMovie;
          String IDMOVIE = Integer.toString(ID);
          IDMovieLabel.setText(IDMOVIE);
  
          try {
              Class.forName("com.mysql.jdbc.Driver");
          } catch (ClassNotFoundException ex) {
              Logger.getLogger(Cover.class.getName()).log(Level.SEVERE, null, ex);
          }
          con = DriverManager.getConnection("jdbc:mysql://localhost/whichmovie", "Asis", "dekrayat24");
  
          String sql = "SELECT Title,Year,Country,recomendacion,Cover,Rating,NameDirec,Name FROM movie "
                  + "Inner join direction on (movie.idMovie=direction.idMovie5)"
                  + "Inner join director on (direction.idDirector=director.idDirector)"
                  + "Inner join cast on (movie.idMovie=cast.idMovie4)"
                  + "Inner join actor on (cast.idActor=actor.idActor)"
                  + "where idMovie= '" + ID + "'";
  
          st = con.prepareStatement(sql);
          rs = st.executeQuery(sql);
  
          while (rs.next()) {
  
              String titulo = rs.getString(1);
              int añoInt = rs.getInt(2);
              String año = Integer.toString(añoInt);
  
              byte[] imagedataCover = rs.getBytes("Country");
              byte[] imagedataCover1 = rs.getBytes("Cover");
              format = new ImageIcon(imagedataCover);
              format2 = new ImageIcon(imagedataCover1);
  
              TituloLabel.setText(titulo);
              AñoLabel.setText(año);
              CountryLabel.setIcon(format);
              DirectorLabel.setText(rs.getString(7));
  
              int Recomend = rs.getInt(4);
              String Recom = Integer.toString(Recomend);
  
              RecommendLabel.setText(Recom);
  
              int Rating = rs.getInt(6);
              String Rat = Integer.toString(Rating);
  
              RatingLabel.setText(Rat);
              starRater1.setSelection(Rating);
              starRater1.setEnabled(false);
  
              Image imgEscalada = format2.getImage().getScaledInstance(CoverLabel.getWidth(),
                      CoverLabel.getHeight(), Image.SCALE_SMOOTH);
              Icon iconoEscalado = new ImageIcon(imgEscalada);
              CoverLabel.setIcon(iconoEscalado);
  
              ArrayList&lt;String&gt; actors = new ArrayList&lt;&gt;();
              actors.add(rs.getString(8));
              System.out.println(actors);// Here i can see i get 9 actors.
  
              StringBuilder sb = new StringBuilder();
  
              boolean first = true;
              for (String s : actors) {
                  if (!first) {
                      sb.append(' ');
                  }
                  sb.append(s);
                  first = false;
              }
  
              CastLabel1.setText(sb.toString());
  
          }
          rs.close();
          st.close();
          con.close();
  
      }
  </code></pre>
  
  <p>Any help ?</p>
  
  <p>Edit:unfortunately no solution has helped me, maybe I'm doing something wrong in the method, I post the full method.</p>