tags:

views:

189

answers:

5

What component would you choose to display XML data in a AWT/Swing Java GUI?

Requirements:

  1. Editable
  2. Basic Syntax Highlight (tags vs.literals)
  3. Pretty-print (i.e. don't display everything in the same line if the XML contains no linebreaks).
+2  A: 

How about JTree ? Here

Webbisshh
+2  A: 

You can use Jaxe

It has the option to use it within another application

Enrique
+2  A: 

try http://code.google.com/p/jsyntaxpane/

Santhosh Kumar T
Looks nice! I won't be able to use it though, because it requires Java 6 and I am currently stuck with 1.4.
Bruno Rothgiesser
Then back port it, probably isn't that hard to do.
Will Hartung
+1  A: 

I've had success with the JEdit Syntax Package. It doesn't automatically pretty-print, but you can do it easily yourself.

ykaganovich
I just tried it, and will look at the JSyntaxPane next because A) jEdit Syntax can't line-wrap (at least, not with a method like JTextPane), and B) it doesn't do a good job at guessing how wide it should scroll. If the window was narrow, it wouldn't be able to scroll to the end of a really long line; wide windows would scroll way past the end of the line I was looking at.
Ed Brannin
+1  A: 

I use RSyntaxTextArea and it works great.

adrian.tarau
That's great, thanks!
Bruno Rothgiesser