slt à tous
voila monb probleme :
je n'arrive pas à afficher le contenu d"un fichier dans mon jeditorpane
voila le code pr la lecture ça marche pas
et merci.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ActionListener open = new ActionListener() {
		public void actionPerformed(ActionEvent e) 
		{
			 JFileChooser jfc = null;
				String laChaine = null;
				RandomAccessFile leFichier = null;
				int res = 0;
				jfc = new JFileChooser();
				jfc.setFileFilter(new FiltreFichiers());
				res = jfc.showDialog(null, "Ouvrir");
 
				if (res == JFileChooser.APPROVE_OPTION)
			{
 
			 //JOptionPane.showMessageDialog(null,jfc.getSelectedFile().getName());
					try
					{  
						leFichier = new RandomAccessFile(jfc.getSelectedFile().getName(),"rw");
 
						try
						{		
					  while (true)	
						{
						laChaine =leFichier.readLine();
 
						}
						}
						catch(EOFException exc)
						{
							System.out.println("fin fichier");
						}
						catch(IOException exce)
						{
							exce.printStackTrace();
						}
					}
					catch(FileNotFoundException ex)
					{
						ex.printStackTrace();
					}
				}
		}
	    };