I am using the following code to read a file. I read the file, do some modifications on it and save it, and I see that my changes have been applied to the file, but when I open the file again in JEditorPane I can't see what I have added to it. the changes that I make to the file are just adding some lines to the end of it.
public void actionPerformed(ActionEvent e) { JEditorPane note = new JEditorPane(); //Handle open button action. if (e.getActionCommand().equals("New File")) { int returnVal = fc.showOpenDialog(UpLoadListener.this); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); try { Content = file.toURI().toURL(); if (Content != null) { try { note.setContentType("text/html"); note.setPage(Content); } catch (IOException e1) { System.err.println("Attempted to read a bad URL: " + Content); } } else { System.err.println("Couldn't find file"); } } catch (MalformedURLException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } } } }