I am looking for some Java Swing component (textarea like) which is aware of SQL syntax - meaning it recognizes and highlights it.
If there isn't I will need to do it开发者_StackOverflow社区 myself, any useful advices there how not waste too much of time (eg. which component to use) ?
JSyntaxPane appears to support SQL highlighting (I have not tried it myself).
I have used Ostermiller's Syntax Highlighter before. It is as simple as:
HighlightedDocument document = new HighlightedDocument();
JTextPane textPane = new JTextPane(document);
You could have a look at SQuirreL SQL. After a quick look at the source code I think it uses Swing and it has an SQL editor with syntax highlight and even content assist.
The MIT-licensed jEdit syntax package supports SQL and many other languages.
I've use the commercial JIDE Code Editor, which uses jEdit and works very well.
精彩评论