public class JDiffTextPanel extends javax.swing.JComponent implements DiffEngine
javax.swing.JComponent.AccessibleJComponentjava.awt.Container.AccessibleAWTContainerjava.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategyDiffEngine.DiffLine| Modifier and Type | Field and Description |
|---|---|
protected CodeEditorDefaults |
defaults
The text editors default.
|
protected CodeEditorHighlighter |
leftHL
The left editor highlighter.
|
protected JEditor |
leftText
The left text editor.
|
protected java.util.List<java.lang.String> |
leftV
The left text as a list.
|
protected CodeEditorHighlighter |
rightHL
The right editor highlighter.
|
protected JEditor |
rightText
The right text editor.
|
protected java.util.List<java.lang.String> |
rightV
The right text as a list.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDELETED, NEW, UNCHANGED, UPDATEDTYPE_FULL_LINES, TYPE_WITHIN_LINES_BASIC, TYPE_WITHIN_LINES_DIFF| Constructor and Description |
|---|
JDiffTextPanel() |
JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV)
Constructor.
|
JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV,
CodeEditorDefaults defaults)
Constructor.
|
JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV,
CodeEditorDefaults defaults,
short diffAlgorithm)
Constructor.
|
JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV,
short diffAlgorithm)
Constructor.
|
JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO)
Constructor.
|
JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO,
CodeEditorDefaults defaults)
Constructor.
|
JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO,
CodeEditorDefaults defaults,
short diffAlgorithm)
Constructor.
|
JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO,
short diffAlgorithm)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createPanel(javax.swing.JComponent leftC,
javax.swing.JComponent rightC,
int dist) |
protected void |
createPanelImpl(javax.swing.JComponent leftC,
javax.swing.JComponent rightC,
int dist) |
short |
getDiffAlgorithm()
Return the diff algorithm
|
JEditor |
getLeftEditor()
Return the left editor.
|
java.util.List<java.lang.String> |
getLeftText()
Return the left text.
|
JEditor |
getRightEditor()
Return the right editor.
|
java.util.List<java.lang.String> |
getRightText()
Return the right text.
|
static void |
main(java.lang.String[] argv) |
void |
populate(DiffBase diffbase)
Populate the content of the diff.
|
protected void |
populatePanel(java.util.List<Change> changes)
Populate the panel.
|
void |
setCodeEditorDefaults(CodeEditorDefaults defaults) |
void |
setColors(java.awt.Color updated,
java.awt.Color addedBefore,
java.awt.Color addedAfter)
Set the Colors.
|
void |
setComparables(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV) |
void |
setComparables(java.lang.Object[] leftO,
java.lang.Object[] rightO) |
void |
setDefaultKeymap() |
void |
setDiffAlgorithm(short diffAlgorithm)
Set the diff algorithm.
|
void |
setEditable(boolean editable)
Sets if this component is editable.
|
void |
setScrollLink(boolean link) |
void |
setStyles(CodeEditorDefaults defaults) |
void |
setTokenMarker(TokenMarker marker)
Set the TokenMarker to use on both the left and the right lines.
|
protected void |
showPanel() |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateDiffResult, getNewLine, populateprotected JEditor rightText
protected JEditor leftText
protected CodeEditorDefaults defaults
protected CodeEditorHighlighter leftHL
protected CodeEditorHighlighter rightHL
protected java.util.List<java.lang.String> rightV
protected java.util.List<java.lang.String> leftV
public JDiffTextPanel()
public JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV)
leftV - the left linesrightV - the right linespublic JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV,
short diffAlgorithm)
leftV - the left linesrightV - the right linesdiffAlgorithm - the diff algorithm used to know how differences within lines are shownpublic JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO)
leftO - the left linesrightO - the right linespublic JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO,
short diffAlgorithm)
leftO - the left linesrightO - the right linesdiffAlgorithm - the diff algorithm used to specify how differences within lines are shownDiffAlgorithmpublic JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV,
CodeEditorDefaults defaults,
short diffAlgorithm)
leftV - the left linesrightV - the right linesdefaults - the defaultsdiffAlgorithm - the diff algorithm used to specify how differences within lines are shownDiffAlgorithmpublic JDiffTextPanel(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV,
CodeEditorDefaults defaults)
leftV - the left linesrightV - the right linesdefaults - the defaultspublic JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO,
CodeEditorDefaults defaults,
short diffAlgorithm)
leftO - the left linesrightO - the right linesdefaults - the defaultsdiffAlgorithm - the diff algorithm used to specify how differences within lines are shownDiffAlgorithmpublic JDiffTextPanel(java.lang.Object[] leftO,
java.lang.Object[] rightO,
CodeEditorDefaults defaults)
leftO - the left linesrightO - the right linesdefaults - the defaultspublic java.util.List<java.lang.String> getLeftText()
getLeftText in interface DiffEnginepublic java.util.List<java.lang.String> getRightText()
getRightText in interface DiffEnginepublic void setCodeEditorDefaults(CodeEditorDefaults defaults)
public void setComparables(java.util.List<java.lang.String> leftV,
java.util.List<java.lang.String> rightV)
public void setComparables(java.lang.Object[] leftO,
java.lang.Object[] rightO)
public void createPanel(javax.swing.JComponent leftC,
javax.swing.JComponent rightC,
int dist)
protected void createPanelImpl(javax.swing.JComponent leftC,
javax.swing.JComponent rightC,
int dist)
public void setStyles(CodeEditorDefaults defaults)
public final void setEditable(boolean editable)
editable - True if this component is editablepublic void setDiffAlgorithm(short diffAlgorithm)
setDiffAlgorithm in interface DiffEnginediffAlgorithm - the diff algorithmpublic short getDiffAlgorithm()
getDiffAlgorithm in interface DiffEnginepublic void setScrollLink(boolean link)
public JEditor getLeftEditor()
public JEditor getRightEditor()
public void setTokenMarker(TokenMarker marker)
marker - the TokenMarkerpublic void setDefaultKeymap()
public void setColors(java.awt.Color updated,
java.awt.Color addedBefore,
java.awt.Color addedAfter)
updated - the updated coloraddedBefore - the added before color (used for lines which are only on the left panel)addedAfter - the added after color (used for lines which are only on the right panel)public void populate(DiffBase diffbase)
populate in interface DiffEnginediffbase - the DiffBaseprotected void populatePanel(java.util.List<Change> changes)
changes - the list of changesprotected void showPanel()
public static void main(java.lang.String[] argv)
throws java.io.IOException
java.io.IOExceptionCopyright © 2016, 2017, 2018, 2019, 2023, 2025 Herve Girod. All Rights Reserved. Documentation and source under the MIT licence