I'm working with a JEditorPane in Java using JForms which displays a file a user opens when it is clicked on. The JEditorPane displays that file and at the moment has syntax highlighting for many files such as c,c++ file,java, python etc.
I'm going through the code and I can see where it initializes this code to highlight the syntax for example lines I found in a switch statement depending on what the user opens
and then the JEditorPane sets the content type with the line
So what I did was modify the existing code to recognize makefiles. I added all the necessary code for the new makefile filetype and just to make sure it was correctly working I used cpp syntax highlighting to make sure I coded it right and yes all my makefiles were being opened in the editor pane using c++ highlighting although it is isn't highlighting the right things as expected.
Now I added a new contentType to see if it would work replacing the lines that used c++ syntax highlighting in my makefiles with
just to see when I opened a makefile it would syntax highlight correctly and it didn't.
I dug deeper into the code specifically the setContentType method and saw that it is compiled code of the JEditorPane class. So I'm guessing that all these other filetypes and their syntax highlighting capabiities are built in java and for makefile syntax highlighting to work, I'm going to have to use custom code?