TYPE_WITHIN_LINES_BASIC
mode shows added, deleted, or updated lines. The updated lines shows the differences within the lines using a basic character by character comparisonTYPE_WITHIN_LINES_DIFF
mode shows added, deleted, or updated lines. The updated lines shows the differences within the lines using a diff algorithm within the lineString[] a = { "aaaTOTOaaa", "aaaTATAaaa", "aaaTATAaaa", "aaaTRRaaa" }; String[] b = { "aaaTOTaaa", "aaaTATAaaa", "aaaTATA TIaaa", "aaaTATAaaa", "aaaTUTUaaa", "aaaTPPaaa", "aaaTRRaaa", "aaaTRIaaa" }; JFrame frame = new JFrame("JDiffTextPanel"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container pane = frame.getContentPane(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); CodeEditorDefaults defaults = new CodeEditorDefaults(); defaults.setPopup(new DefaultEditorPopup()); JDiffTextPanel panel = new JDiffTextPanel(a, b, defaults); panel.setTokenMarker(new BasicTokenMarker()); pane.add(panel); frame.pack(); frame.setVisible(true);with the folllowing result:
Copyright 2016-2019 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence