
12/04/2016, 11:11
|
 | | | Fecha de Ingreso: abril-2016
Mensajes: 17
Antigüedad: 8 años, 10 meses Puntos: 1 | |
Respuesta: Hilo de despacho de eventos Runnable miRunnable = new Runnable()
{
public void run()
{
try
{ 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();
Thread.sleep(2000);
txtaenviar.setText(parametro);
}
}
}catch (IOException e) {
JOptionPane.showMessageDialog(null, e);
}
System.out.println("Terminé");
}
catch (Exception e)
{
e.printStackTrace();
}
}
};
Thread hilo = new Thread (miRunnable);
hilo.start(); |