Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/04/2016, 11:52
Avatar de Sexy10
Sexy10
 
Fecha de Ingreso: abril-2016
Mensajes: 17
Antigüedad: 8 años, 1 mes
Puntos: 1
Exclamación Porque no imprime en el bucle

Ayuda por favor!
Estoy recibiendo datos de un archivo.txt pero los quiero enviar uno por uno a un textarea pero lo unico que hace es perar los 6 segundos y despues los imprime todos de golpe pregunta ¿como lo hago?
------------Codigo---------------------------------------------------------------------------------------
File f = new File("C:/victor.txt");
BufferedReader br;
try {
br= new BufferedReader( new FileReader( f ) );
String linea="";
while(br.ready()){
linea = br.readLine();
StringTokenizer st=new StringTokenizer(linea,"\n");
while (st.hasMoreElements()) {
String parametro = (String) st.nextElement();
try {
sleep(1000);
txtarecibir.setText(txtarecibir.getText()+parametr o+"\n");
} catch (InterruptedException ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
}
}catch (IOException e) {
JOptionPane.showMessageDialog(null, e);
}

Última edición por Sexy10; 06/04/2016 a las 11:58