tags:

views:

298

answers:

3

Hello, I plan on making a multi comparison program. It will compare multiple files by displaying N number of files in a grid where N = X * Y. X and Y are the width and height of the grid elements. Easy enough, I know how to do this pretty much.

The question: How do and in what way is best to highlight individual characters in each of these grid elements? I plan on highlighting matching text that is found in the same position.

A: 

I'm not sure what you mean by "Highlight the characters", but to bring attention to grid elements, or pairs of grid elements, you could set the background color of the appropriate component.

JoshuaD
Need to highlight the invidiual letters. For example, if 'ABC' and 'ACB' are being compared, both A's need to be highlighted.
Zombies
+1  A: 

You could use a JTextArea with a Highlighter. See the second example on this page for how.

Dan Vinton
+1  A: 

I'd use a JTextPane rather than a JTextArea, and read up on the StyledDocument class. This will give you all sorts of options.

Nick Fortescue