merci, ça marche j'ai fait comme tu as, j'ai instancié la classe à l'extérieur du méthode
je essaie aussi de rédirigé la sortie de la méthodeCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 Snippet s = new Snippet(); public void actionPerformed(ActionEvent e) { // Snippet s = new Snippet(); if (e.getSource() == btnSynchronisation) { s.ExecuteTachFond(); try { //System.setOut(new PrintStream(Thread_Action.)); // JTextConsole.read(in, s.ExecuteTachFond()); JTextConsole.read(new InputStreamReader(s.getTa().getP().getErrorStream()), null); JTextConsole.read(new InputStreamReader(s.getTa().getP().getOutputStream()), null); JTextConsole.setText(JTextConsole.getText()); } catch (IOException ex) { Logger.getLogger(AccueilRsync1.class.getName()).log(Level.SEVERE, null, ex); } } if ((e.getSource() == btnStopSynchronisation)) { //Snippet s = new Snippet(); // if (btnSynchronisation.isPaintingTile()){ // btnSynchronisation.removeActionListener(this); System.out.println(s.isExecution()); s.stop(); } }
vers un JTxtarea au lieu de la console, c'est pourquoi j'ai ajouté de getter et de setter pour pourvoir accéder a P, T_out et T_err.Code:
1
2 private Thread creeThreadFluxLecture(final InputStream inputStream){ ....}
mais ça me renvoi aussi une exception null, tu pense que c'est comme ça que je dois faire pour ré diriger la console vers le JTextArea.Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 public class Thread_Action extends Thread { Process p; Thread t_out; Thread t_err; public Process getP() { return p; } public void setP(Process p) { this.p = p; } public Thread getT_err() { return t_err; } public void setT_err(Thread t_err) { this.t_err = t_err; } public Thread getT_out() { return t_out; } public void setT_out(Thread t_out) { this.t_out = t_out; .....
merci pour toutes vos réponses