I am trying to display a particular text file in JTextArea but eclipse keeps showing me an error.
try {
FileReader reader = new FileReader("Student.txt");
BufferedReader br = new BufferedReader(reader);
JTextArea.read(br,null);
br.close();
JTextArea.requestFocus();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, "Something went wrong");
}
this is the code i am using and the error i get is
"Cannot make a static reference to the non-static method read(Reader, Object) from the type JTextComponent"