slt jcrée un projet pour creation d'un editeur compilateur java,
et j'ai etabli un document listener pour sauvegarde puis compilation.
ça marche tres b1sur les fichiers deja existant mais pas si je crée un nouveau fichier,en realité j'écrie mais et les les lettres ne s'affiche que lorsque je selectionne avec la souris puis ça reste en affichage et ainsi de suite .

voila mon listner
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
editpane1.getDocument().addDocumentListener(new DocumentListener(){
    	  public void insertUpdate(DocumentEvent de) {
    		  enregistrerFichier(); 
    		  compilation();}
    	  public void removeUpdate(DocumentEvent de) {
    		  enregistrerFichier(); 
    		  compilation();}
    	  public void changedUpdate(DocumentEvent arg0) {
    		  //Plain text components don't fire these events
    		  }
    	});
et voil les erreurs:
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
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at com.sun.tools.javac.util.DefaultFileManager.nullCheck(DefaultFileManager.java:1239)
	at com.sun.tools.javac.util.DefaultFileManager.getJavaFileObjectsFromFiles(DefaultFileManager.java:1098)
	at com.sun.tools.javac.util.DefaultFileManager.getJavaFileObjects(DefaultFileManager.java:1103)
	at edit.Editeur.compilation(Editeur.java:366)
	at edit.Editeur.access$13(Editeur.java:357)
	at edit.Editeur$2.insertUpdate(Editeur.java:93)
	at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source)
	at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source)
	at javax.swing.text.AbstractDocument.insertString(Unknown Source)
	at javax.swing.text.PlainDocument.insertString(Unknown Source)
	at javax.swing.text.AbstractDocument.replace(Unknown Source)
	at javax.swing.text.JTextComponent.replaceSelection(Unknown Source)
	at javax.swing.JEditorPane.replaceSelection(Unknown Source)
	at javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction.actionPerformed(Unknown Source)
	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
	at javax.swing.JComponent.processKeyBinding(Unknown Source)
	at javax.swing.JComponent.processKeyBindings(Unknown Source)
	at javax.swing.JComponent.processKeyEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)