5

I'm writing a programm in which I need to generate a diff and display the result. Is there any GUI component out there, with which I can easily accomplish this task, or do I need to hack something for myself?

I'd prefer using a Swing component, but any other technology will be fine, too.

6 Answers 6

2

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

Up to now, it is my preferred solution, to output HTML to a JEditorPane - as a related project I'm working on is also using HTML to generate and display the reports. As I can't use NetBeans, I decided to go with JDiff lib, mentioned in an earlier answer. Thanks for providing all the answers!
1

As far as i know there is no component for this. Any modern IDE does this job today, also source control plugins have this function, many of them are open source so you can get the idea by viewing them. But it would be hard.


@madlep has a solution with Difference algorithm for Java check this topic:

Generate formatted diff output in Java

Comments

1

Take a look here .

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

Hope it will help !

Comments

0

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


Or have a look at the Java diff viewer Component? thread, it seems that someone had similar needs and you will find a solution based on incava.org's Diff implementation (the location of sources changed so I'm putting the new location below):

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

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

Comments

0

I know IntelliJ IDEA can do this, and they've recently released an open-source community edition, so the code is in there somewhere. It will probably taken a bit of digging to find the relevant code though!

check here

and The code is all available here (via GIT or on the web):

Comments

0

https://github.com/albfan/jmeld

JMeld, A visual diff and merge tool.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.