separate objects

0

My problem is that I need to separate an Object and I do not even know if it can be done.

In the software the user must enter a desired number of players registered in a DB by first and last name, then call that list to put it in a table versus Example: if they are 10 players, they must be distributed in a Jtable with three columns ("Player 1", "V / S", "Player 2") where in the first and last row 5 names are inserted randomly.

while (result.next()){
        //los resultset traidos como nombre y apellido 
        //insertados en un String
        nombre =result.getString("nombre")+" "+result.getString("apellido");

      //Creo un Object para guardar todos los resultados
      //Lo pongo dentro de un DefaultTableModel como fila
      dtm.addRow( new Object[] {nombre});
       }

Versus.setModel (qsjt.buscarTablaTorneo (IDTORNEO, A));

with that I insert it in my table

[1]: link [! [that's what it looks like] [1]] [1]

I need to separate that to be able to face my players

    
asked by Sodro 11.01.2018 в 02:03
source

1 answer

0

The detail is in this line.

  

dtm.addRow (new Object [] {name});

You must separate the values in the following way, since each item represents the column of each row.

Object jugadores[]={ "Jugador 1",//  columna del primer jugador
                     " ", //segunda columna vacia
                     "Jugador 2" //columna del segundo jugador
                    };      
    dtm.addRow(jugadores); // se ingresa los valores previos
    
answered by 11.01.2018 / 11:43
source