JTextArea para ArrayList

1 resposta
G

Gostaria de saber como faço para exibir um ArrayList em uma JtextArea.

import java.io.*;
import javax.swing.JFileChooser;
import java.io.File; 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class lerArquivo extends JFrame{ 
	
  
             public static void main(String[] args) { 
			 
        File file = new File("c:\\Users\\teste1.txt");  
                try {  
                  FileReader reader = new FileReader(file);  
                  BufferedReader input = new BufferedReader(reader);  
					String linha;
					JTextArea text = new JTextArea(text);
                  while ((linha = input.readLine()) != null) {
						String [] nome1 = linha.split(" "); 
						//String linha1 = "SNE." + nome1 + "_" + sobrenome;
						System.out.println(nome1[0]);
						System.out.println(nome1[1] + "_" + nome1[2]);
						JTextArea textarea = new JTextArea();
						for (String n: nome1)
						textarea.append(n);
						//System.out.println(nome1[2]);
						//System.out.println(linha1.replace(" ", "_"));
                    /*System.out.println(linha);  */
                  }  
                  input.close();  
                } catch (IOException ioe) {  
                   System.out.println(ioe);  
                }  
  
    }  
  
}

Obrigado!

1 Resposta

gpd38

http://www.java2s.com/Code/Java/Swing-JFC/TextArea.htm

http://stackoverflow.com/questions/9186530/how-to-output-a-vector-into-a-jtextarea-in-a-jframe

Criado 4 de fevereiro de 2015
Ultima resposta 18 de fev. de 2015
Respostas 1
Participantes 2