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

// me costo pero aqui esta por si alguien lo necesita!!
Código Java:
Ver original
  1. Runnable miRunnable = new Runnable()
  2.       {
  3.          public void run()
  4.          {
  5.             try
  6.             { File f = new File("C:/victor.txt");
  7. try {
  8. br= new BufferedReader( new FileReader( f ) );
  9. String linea="";
  10. while(br.ready()){
  11. linea = br.readLine();
  12. StringTokenizer st=new StringTokenizer(linea,"\n");
  13.        while (st.hasMoreElements()) {
  14.        String parametro = (String) st.nextElement();
  15.         Thread.sleep(2000);
  16.         txtaenviar.setText(parametro);
  17.        }
  18. }
  19. }catch (IOException e) {
  20. JOptionPane.showMessageDialog(null, e);
  21. }
  22.  System.out.println("Terminé");
  23.             }
  24.             catch (Exception e)
  25.             {
  26.                e.printStackTrace();
  27.             }
  28.          }
  29.       };
  30.       Thread hilo = new Thread (miRunnable);
  31.       hilo.start();