What code highlighting libs are there for Java?

女生的网名这么多〃 提交于 2019-11-27 03:22:25

问题


I'd like them to be easy to bundle, with few dependencies and easy to use.


回答1:


Do you want to highlight Java code or use a Java lib to highlight some other code?

I use these two: https://jhighlight.dev.java.net/ (server-side) for xml and http://code.google.com/p/syntaxhighlighter/ (js lib) for other stuff. The latter has something called 'brushes' which are "pluggable" .js for several langauges. If you are doing simple highlighting, I recommend the ,js approach.




回答2:


http://sourceforge.net/projects/jintilla/

http://syntax.jedit.org/




回答3:


http://tohtml.com/ this one is good.




回答4:


A little update, as we were recently looking for highlighting lib, we found the very good Jygments : http://code.google.com/p/jygments/ .

Available for Ant/Maven/SBT projects throught threecrickets repo, it's a Java port of Pygments ( http://pygments.org ), working for several major languages.




回答5:


RSyntaxTextArea is worked for meHere

        RSyntaxTextArea textArea = new RSyntaxTextArea();
        textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
        textArea.setCodeFoldingEnabled(true);
        RTextScrollPane rs = new RTextScrollPane(textArea);


来源:https://stackoverflow.com/questions/221570/what-code-highlighting-libs-are-there-for-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!