title: I want to add several lines to a cell of jTable
body: <p>I have this code for filling the jTable</p>
  
  <pre><code>public void llenarTabla() {               
      DefaultTableModel modelo = new DefaultTableModel(){
      @Override  
          public Class getColumnClass(int col) {
              switch(col) {
                  case 0: return ImageIcon.class;
                  case 1: return Object.class;
                  default: return Object.class;
              }
          }
      };
      tblAnimales.setModel(modelo);
      int i  = 0;
      try {
          //Llenar las cabeceras de la tabla
          modelo.addColumn("Foto");
          modelo.addColumn("Nombre");
  
          if (cboOrdenar.getSelectedIndex() &lt; 2) {
              if (cboOrdenar2.getSelectedIndex() == 0) {
                  rs = animal.consultarEn(cboMostrar.getSelectedItem().toString(), cboOrdenar.getSelectedItem().toString(), "ASC"); 
                  //System.out.println(cboMostrar.getSelectedItem().toString() + cboOrdenar.getSelectedItem().toString() + "ASC");
              } else {
                  rs = animal.consultarEn(cboMostrar.getSelectedItem().toString(), cboOrdenar.getSelectedItem().toString(), "DESC");
                  //System.out.println(cboMostrar.getSelectedItem().toString() + cboOrdenar.getSelectedItem().toString() + "DESC");
              }
          } else if (cboOrdenar.getSelectedIndex() == 2){
              rs = animal.consultarPor(cboMostrar.getSelectedItem().toString(), "size", cboOrdenar2.getSelectedItem().toString());
              //System.out.println(cboMostrar.getSelectedItem().toString() + "size" + cboOrdenar2.getSelectedItem().toString());
          } else {
              rs = animal.consultarPor(cboMostrar.getSelectedItem().toString(), cboOrdenar.getSelectedItem().toString(), cboOrdenar2.getSelectedItem().toString());
              //System.out.println(cboMostrar.getSelectedItem().toString() + cboOrdenar.getSelectedItem().toString() + cboOrdenar2.getSelectedItem().toString());
          }
  
          while (rs.next()) {
              Blob blob = rs.getBlob("foto");
              byte[] data = blob.getBytes(1, (int)blob.length());
              blob.free();
  
              BufferedImage img = ImageIO.read(new ByteArrayInputStream(data));
              ImageIcon icon = new ImageIcon(img);
  
              Object [] ob = new Object[2];
              ob[0] = icon;
              ob[1] = rs.getString("idAnimal") + ". " + rs.getString("nombre") + "\n" +
                      "Especie:" + rs.getString("especie") + "\n" +
                      "Raza:" + rs.getString("raza") + "\n" +
                      "Tamaño:" + rs.getString("size") + "\n" +
                      "Edad:" + rs.getString("edad") + " meses\n" +
                      "Características:\n:" + rs.getString("caracteristicas");
  
              modelo.addRow(ob);
              ob = null;
              tblAnimales.setRowHeight(i, 200);
              i++;
          }
      } catch (SQLException | IOException ex) {
          System.out.println("Error en MdiHuellitas.llenarTabla()\n" + ex.getMessage());
      }        
  }
  </code></pre>
  
  <p>But the case shows the data in just one line, plus I get a Error and the jTable just fills one row when there should be 3. I'm taking the data from mysql, the animal.consultar methods all work ok.</p>
  
  <p><a href="https://i.stack.imgur.com/byD4u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/byD4u.png" alt="enter image description here"></a></p>
  
  <p>The line with the first Error is the next:</p>
  
  <pre><code>byte[] data = blob.getBytes(1, (int)blob.length());
  </code></pre>