7

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 myself, any useful advices there how not waste too much of time (eg. which component to use) ?

Abhinav Sarkar
  • 23,534
  • 11
  • 81
  • 97
Xorty
  • 18,367
  • 27
  • 104
  • 155

4 Answers4

9

JSyntaxPane appears to support SQL highlighting (I have not tried it myself).

Mark
  • 28,783
  • 8
  • 63
  • 92
2

I have used Ostermiller's Syntax Highlighter before. It is as simple as:

HighlightedDocument document = new HighlightedDocument();
JTextPane textPane = new JTextPane(document);
dogbane
  • 266,786
  • 75
  • 396
  • 414
1

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.

musiKk
  • 14,751
  • 4
  • 55
  • 82
1

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.

Geoffrey Zheng
  • 6,562
  • 2
  • 38
  • 47
  • If only JIDE Code Editor would some day come out of the beta stage... I think it has been beta maybe for two years now. – Carlos Sep 23 '10 at 21:51
  • @Carlos: did you find any major problems? I just started to use it and find it ok so far. When did gmail come out of beta? – Geoffrey Zheng Sep 23 '10 at 22:41
  • No. I'm sure it works and most certainly better than jEdit syntax package. But obviously there is still something missing, otherwise they wouldn't keep it in beta. I was just wondering if they are actively developing it. I didn't mean to criticize the component itself. – Carlos Sep 23 '10 at 22:45
  • @Carlos: hey now I remember you from the [JIDE answer](http://stackoverflow.com/questions/2055647/looking-for-a-feedback-on-jide/2058811#2058811 "JIDE Fan Club")! No wonder... Why don't you just ask them on the forum, then. You know David will get back to you in no time. – Geoffrey Zheng Sep 23 '10 at 23:54
  • It's not an issue for me at the moment, that's just something I've been wondering. At some point I need to replace the syntax package, but that's not the most urgent problem. I want to clarify, that my original comment was not meant as criticism or to discourage from using it, just an observation. – Carlos Sep 24 '10 at 07:15