Por algum motivo, ao abrir o arquivo utilizando FileReader e BufferedReader para colocar o código no JTextPane, a manipulação no texto não ocorre, qualquer modificação nele não acontece, diferente de quando eu coloco o texto manualmente no JTextPane, alguém saberia me dizer porque isso ocorre e como corrigir?
Segue o método que eu estou usando para abrir o arquivo.JFileChooser fc = new JFileChooser();
fc.setMultiSelectionEnabled(true);
fc.setDialogType(JFileChooser.OPEN_DIALOG);
fc.setDialogTitle("Abrir Arquivo");
int returnVal = fc.showDialog(this,null);
if (returnVal == JFileChooser.APPROVE_OPTION){
file = fc.getSelectedFiles();
try {
System.out.println(file.length);
String texto = "";
//tx_Code.setText(texto);
for (int i = 0; i < file.length;i++){
leitor = new FileReader(file[i]);
BufferLeitor = new BufferedReader(leitor);
try {
if ((texto = BufferLeitor.readLine()) != null){
//jTCodigo.setText(texto);
while((texto = BufferLeitor.readLine()) != null){
tx_Code.setText(tx_Code.getText() + "\n" + texto);
}
}
} catch (IOException ex) {
Logger.getLogger(JanelaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (FileNotFoundException ex) {
Logger.getLogger(JanelaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
}
}