Jump to content
Fórum Script Brasil
  • 0

Matriz


marcelo

Question

Estou inserido nomes em uma matriz só que ela esta perdendo valores so mostra o ultimo ex:

     saida+= "Id\n";
     nomeMes[i][j]= cl0.getText();
     System.out.println("  " + (i)+(j) + "- " + nomeMes[i][j]);      
     novo[i][j]=nomeMes[i][j];  
     
     j++;    
     saida+= "Nome:";
     nomeMes[i][j]= cl1.getText();
     System.out.println("  " + (i)+(j) + "- " + nomeMes[i][j]);      
     novo[i][j]=nomeMes[i][j];  
     
     j++;
     saida+= "Enderenço:";
     nomeMes[i][j]= cl2.getText();
     System.out.println("  " + (i)+(j) + "- " + nomeMes[i][j]);      
     novo[i][j]=nomeMes[i][j];  
     
     
     j++;
     saida+= "Telefone:";
     nomeMes[i][j]= cl3.getText();
     System.out.println("  " + (i)+(j) + "- " + nomeMes[i][j]);      
     novo[i][j]=nomeMes[i][j];  
      

     j++;
     saida+= "E-mail:";
     nomeMes[i][j]= cl4.getText();
     System.out.println("  " + (i)+(j) + "- " + nomeMes[i][j]);      
     novo[i][j]=nomeMes[i][j];  
     
        
     
     
     for (j=0;j<4;j++){
     
     //saida+= "Id\nNome\nEnderenço\nTelefone\nE-amail\n";
     saida += nomeMes[i][j]+"\t";
     saida +="\n";
}    

/*     JTextArea saidad = new JTextArea(10,11);
     saidad.setText(saida);
    
     JOptionPane.showMessageDialog(null,saidad);
          
*/
     if (i==2){
      
      JOptionPane.showMessageDialog(null," ---  "+ (0)+(0) +novo[0][0],"Aviso",JOptionPane.ERROR_MESSAGE);
  JOptionPane.showMessageDialog(null," ---  "+ (0)+(1) +novo[0][1],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (0)+(2) +novo[0][2],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (0)+(3) +novo[0][3],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (0)+(4) +novo[0][4],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (1)+(0) +novo[1][0],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (1)+(1) +novo[1][1],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (1)+(2) +novo[1][2],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (1)+(3) +novo[1][3],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (1)+(4) +novo[1][4],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (2)+(0) +novo[2][0],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (2)+(1) +novo[2][1],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (2)+(2) +novo[2][2],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (2)+(3) +novo[2][3],"Aviso",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null," ---  "+ (2)+(4) +novo[2][4],"Aviso",JOptionPane.ERROR_MESSAGE);
      

ele so mostrar o valor apartir do novo[2][0] alguém pode me ajudar como faco para pegar todos os valores apartir do novo[0][0]

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...