I have a JEditorPane in my application and I was loading java files into it using jsyntaxpane and the following code and it was working perfectly:
to highlight
jsyntaxpane.DefaultSyntaxKit.initKit();
textarea.setContentType("text/java");
to load file in
int a = filesToCompileList.getSelectedIndex();
FileReader reader = new FileReader(file);
BufferedReader br = new BufferedReader(reader);
textarea.read.read(br, index);
br.close();
textarea.requestFocus();
but know i had to change the way i was loading the file in and i am currently loading the files in like
File file = new File(filePath);
textarea.setPage(file.toURI().toURL());
this is loading the files in the way i want but isn't highlighting the text for java files anymore! does anybody know how i can fix this or get java highlighting a different way?