I am trying to open a file through the following programcode
public void actionPerformed(ActionEvent e)
{
else if(e.getSource() == menyFlikTre)
{
läsInFil(textFalt.getText());
}
private void läsInFil(String filename)
{
try {
FileReader r = new FileReader(filename);
textArea.read(r, null);
}
catch(IOException e){}
}
When i put in the name of the file with the .txt extension, it only adds the entire name of the file including the extension .txt instead of the content of the file.
You should loop thorough the content of the file and add it to the textArea :