Java: GUI component for displaying differences?

I am writing a program in which I need to create a diff and display the result. Is there any GUI component with which I can easily complete this task, or do I need to hack something for myself?

I would rather use the Swing component, but any other technology would be great too.

+4
source share
6 answers

There is a diff tool if you are building a NetBeans platform.

If you cannot use this, I don’t think it would be difficult to create a basic one that uses HTML in JEditorPane to display the results.

+2
source

As far as I know, there is no component for this. Any modern IDE does this job today, and version control plugins have this feature, many of which are open source, so you can get this idea by looking at them. But that would be difficult.


@madlep has a solution with a difference algorithm for Java , check this section:

Generate formatted diff output in Java

+1
source

Take a look here .

I used Diff.java to create a JPanel that will show the differences between the two files.

Hope this helps!

+1
source

I know that IntelliJ IDEA can do this, and they recently released an open source community version, so the code is somewhere out there. Most likely, it will take a little digging to find the appropriate code!

check here

and the code is available here (via GIT or online):

0
source

Perhaps take a look at JDiffPlugin for jEdit (it might be easier than digging the source code for Eclipse / NetBeans / IntelliJ).


Or look at the Java diff diff viewer component stream? it looks like someone had similar needs and you will find a solution based on incava.org Diff implementation (the location of the sources has changed, so I put the new location below):

(for Diff sources)
http://dawes.za.net/gitweb.cgi?p=rogan/webscarab/webscarab.git;a=tree;h=148dc26a7ff3ef6ff5ddc35b206

(for DiffPanel sources)
http://dawes.za.net/gitweb.cgi?p=rogan/webscarab/webscarab.git;a=tree;h=f6b756fbe78c6f1be21a00cffbe

0
source

https://github.com/albfan/jmeld

JMeld, a visual demarcation and merge tool.

0
source

All Articles