# Class SHTMLEditorPane

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JEditorPane
com.lightdev.app.shtm.SHTMLEditorPane

All Implemented Interfaces:
  `DragGestureListener, DragSourceListener, DropTargetListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, Scrollable`

public class SHTMLEditorPane extends JEditorPane implements DropTargetListener, DragSourceListener, DragGestureListener
An editor pane for application SimplyHTML.

This is extending `JEditorPane` by cut and paste and drag and drop for HTML text. `JEditorPane` inherits cut and paste from `JTextComponent` where handling for plain text is implemented only. `JEditorPane` has no additional functionality to add cut and paste for the various content types it supports (such as 'text/html').

In stage 4 support for caret movement inside tables and table manipulation methods are added.

In stage 6 support for list manipulation was added.

See Also:
  - `HTMLText`
  - `HTMLTextSelection`
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`SHTMLEditorPane.PasteMode`

### Nested classes/interfaces inherited from class JEditorPane

`JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.JEditorPaneAccessibleHypertextSupport`

### Nested classes/interfaces inherited from class JTextComponent

`JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding`

### Nested classes/interfaces inherited from class JComponent

`JComponent.AccessibleJComponent`

### Nested classes/interfaces inherited from class Container

`Container.AccessibleAWTContainer`

### Nested classes/interfaces inherited from class Component

`Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ALL_CELLS`
range indicator for applying attributes to all cells
`static final String`
`DEFAULT_TABLE_WIDTH`
default table width
`static final String`
`DEFAULT_VERTICAL_ALIGN`
default vertical alignment
`static final String`
`deleteNextCharAction`
`static final String`
`deletePrevCharAction`
`static final String`
`endAction`
`static final String`
`homeAction`
`static final String`
`insertLineBreakAction`
`static final String`
`moveDownAction`
`static final String`
`moveUpAction`
`static final String`
`newListItemAction`
`static final String`
`shiftEndAction`
`static final String`
`shiftHomeAction`
`static final int`
`THIS_CELL`
range indicator for applying attributes to the current cell only
`static final int`
`THIS_COLUMN`
range indicator for applying attributes to cells of the current column only
`static final int`
`THIS_ROW`
range indicator for applying attributes to cells of the current row only

### Fields inherited from class JEditorPane

`HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS`

### Fields inherited from class JTextComponent

`DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY`

### Fields inherited from class JComponent

`listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

### Fields inherited from class Component

`accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

### Fields inherited from interface ImageObserver

`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

## Constructor Summary

Constructors
Constructor
Description
`SHTMLEditorPane()`
construct a new `SHTMLEditorPane`

## Method Summary

Modifier and Type
Method
Description
`void`
`appendTableColumn()`
append a table column after the last column (if any)
`void`
`appendTableRow()`
Appends a row to a table if the caret is inside a table.
`void`
`applyAttributes(AttributeSet attributeSet, boolean applyToCompleteParagraph)`
`void`
`applyAttributes(AttributeSet attributeSet, boolean applyToCompleteParagraph, boolean replace)`
Sets the attributes for a given part of this editor.
`void`
`applyCellAttributes(AttributeSet a, int range)`
apply a set of attributes to a given range of cells of the table the caret is currently in (if any)
`void`
`applyCharacterTag(String tag)`
(Unfinished.)
`void`
`applyListAttributes(AttributeSet a)`
apply a set of attributes to the list the caret is currently in (if any)
`void`
`applyParagraphTag(String tag, Vector overwritableTags)`
Switches the elements in the current selection to the given tag.
`void`
`applyTableAttributes(AttributeSet a)`
apply a set of attributes to the table the caret is currently in (if any)
`protected EditorKit`
`createDefaultEditorKit()`
`void`
`deleteTableCol()`
delete the column of the table the caret is currently in (if any)
`void`
`deleteTableRow()`
delete the row of the table the caret is currently in (if any)
`void`
`dragDropEnd(DragSourceDropEvent event)`
this message goes to DragSourceListener, informing it that the dragging has ended
`void`
`dragEnter(DragSourceDragEvent event)`
this message goes to DragSourceListener, informing it that the dragging has entered the DropSite
`void`
`dragEnter(DropTargetDragEvent event)`
is invoked when you are dragging over the DropSite
`void`
`dragExit(DragSourceEvent event)`
this message goes to DragSourceListener, informing it that the dragging has exited the DropSite
`void`
`dragExit(DropTargetEvent event)`
is invoked when you are exit the DropSite without dropping
`void`
`dragGestureRecognized(DragGestureEvent event)`
a drag gesture has been initiated
`void`
`dragOver(DragSourceDragEvent event)`
this message goes to DragSourceListener, informing it that the dragging is currently occurring over the DropSite
`void`
`dragOver(DropTargetDragEvent event)`
is invoked when a drag operation is going on
`void`
`drop(DropTargetDropEvent event)`
a drop has occurred.
`void`
`dropActionChanged(DragSourceDragEvent event)`
is invoked when the user changes the dropAction
`void`
`dropActionChanged(DropTargetDragEvent event)`
is invoked if the user modifies the current drop gesture
`String`
`elementToHTML(Element element)`
Returns the string HTML representation of the element.
`Element`
`getCurrentLinkElement()`
`Element`
`getCurrentParagraphElement()`
Gets the paragraph element in which the caret is located.
`Element`
`getCurrentTableCell()`
Gets the table cell at the current caret position.
`SHTMLDocument`
`getDocument()`
`SHTMLEditorPane.PasteMode`
`getPasteMode()`
`JPopupMenu`
`getPopup()`
`String`
`getSelectedText()`
`Element`
`getTableCell(int position)`
Gets the table cell element at the given position, or null if none.
`TransferHandler`
`getTransferHandler()`
`void`
`goNextCell(Element cell)`
`void`
`goPrevCell(Element cell)`
`void`
`initDnd()`
Initialize the drag and drop implementation for this component.
`void`
`insertAnchor(String anchorName)`
apply a new anchor to the currently selected text
`void`
`insertBreak()`
insert a line break (i.e.
`void`
`insertNewTable(int colCount)`
Insert a new table.
`void`
`insertTableColumn()`
insert a table column before the current column (if any)
`void`
`insertTableRow(String forcedCellName)`
Inserts a row to a table, assuming the caret is currently inside a table.
`protected boolean`
`processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)`
`void`
`removeAnchor(String anchorName)`
remove an anchor with a given name
`void`
`removeCharacterAttributes()`
`void`
`removeParagraphAttributes()`
`void`
`replaceSelection(com.lightdev.app.shtm.HTMLText replacementHTMLText)`
Replaces the currently selected content with new content represented by the given `HTMLText`.
`void`
`replaceSelection(String content)`
`void`
`setDocument(Document doc)`
`void`
`setLink(String linkText, String href, String className)`
set a text link at the current selection replacing the selection with a given text.
`void`
`setLink(String linkText, String href, String className, String linkImage, Dimension size)`
Sets a hyperlink at the current selection, replacing the selection with the given text or image.
`void`
`setPasteMode(SHTMLEditorPane.PasteMode pasteMode)`
`void`
`setPasteModeFromPrefs()`
`void`
`setPopup(JPopupMenu popup)`
`void`
`setText(String text)`
Convenience method for setting the document text
`void`
`setUI(TextUI newUI)`
`void`
`toggleList(String listTag, AttributeSet attributeSet, boolean forceOff)`
toggle list formatting on or off for the currently selected text portion.
`void`
`toggleTableHeaderCell()`
For each cell within the selection, turns a table data cell into a table header cell or vice versa.
`boolean`
`tryDefaultKeyStrokeActionWithinCell(int keyCode, int modifiers, ActionEvent event)`
Performs the default key stroke action, assuming that the caret is within a table cell and that the action is a cursor move; if the cursor leaves the current table cell, undoes the action.
`void`
`updateUI()`

### Methods inherited from class JEditorPane

`addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, getUIClassID, paramString, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage`

### Methods inherited from class JTextComponent

`addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, modelToView2D, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, viewToModel, viewToModel2D, write`

### Methods inherited from class JComponent

`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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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`

### Methods inherited from class Container

`add, 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, validateTree`

### Methods inherited from class Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### THIS_CELL

public static final int THIS_CELL
range indicator for applying attributes to the current cell only

See Also:
  - Constant Field Values

### THIS_COLUMN

public static final int THIS_COLUMN
range indicator for applying attributes to cells of the current column only

See Also:
  - Constant Field Values

### THIS_ROW

public static final int THIS_ROW
range indicator for applying attributes to cells of the current row only

See Also:
  - Constant Field Values

### ALL_CELLS

public static final int ALL_CELLS
range indicator for applying attributes to all cells

See Also:
  - Constant Field Values

### DEFAULT_TABLE_WIDTH

public static final String DEFAULT_TABLE_WIDTH
default table width

See Also:
  - Constant Field Values

### DEFAULT_VERTICAL_ALIGN

public static final String DEFAULT_VERTICAL_ALIGN
default vertical alignment

See Also:
  - Constant Field Values

### newListItemAction

public static final String newListItemAction

See Also:
  - Constant Field Values

### insertLineBreakAction

public static final String insertLineBreakAction

See Also:
  - Constant Field Values

### deletePrevCharAction

public static final String deletePrevCharAction

See Also:
  - Constant Field Values

### deleteNextCharAction

public static final String deleteNextCharAction

See Also:
  - Constant Field Values

### moveUpAction

public static final String moveUpAction

See Also:
  - Constant Field Values

### homeAction

public static final String homeAction

See Also:
  - Constant Field Values

### shiftHomeAction

public static final String shiftHomeAction

See Also:
  - Constant Field Values

### shiftEndAction

public static final String shiftEndAction

See Also:
  - Constant Field Values

### endAction

public static final String endAction

See Also:
  - Constant Field Values

### moveDownAction

public static final String moveDownAction

See Also:
  - Constant Field Values

## Constructor Details

### SHTMLEditorPane

public SHTMLEditorPane()
construct a new `SHTMLEditorPane`

## Method Details

### createDefaultEditorKit

protected EditorKit createDefaultEditorKit()

Overrides:
  `createDefaultEditorKit` in class `JEditorPane`

### updateUI

public void updateUI()

Overrides:
  `updateUI` in class `JTextComponent`

### setUI

public void setUI(TextUI newUI)

Overrides:
  `setUI` in class `JTextComponent`

### getDocument

public SHTMLDocument getDocument()

Overrides:
  `getDocument` in class `JTextComponent`

### setDocument

public void setDocument(Document doc)

Overrides:
  `setDocument` in class `JTextComponent`

### getPasteMode

public SHTMLEditorPane.PasteMode getPasteMode()

### setPasteMode

public void setPasteMode(SHTMLEditorPane.PasteMode pasteMode)

### setPasteModeFromPrefs

public void setPasteModeFromPrefs()

### processKeyBinding

protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)

Overrides:
  `processKeyBinding` in class `JComponent`

### setText

public void setText(String text)
Convenience method for setting the document text

Overrides:
  `setText` in class `JEditorPane`
Parameters:
  `text` - the html-text of the document

### applyListAttributes

public void applyListAttributes(AttributeSet a)
apply a set of attributes to the list the caret is currently in (if any)

Parameters:
  `a` - the set of attributes to apply

### toggleList

public void toggleList(String listTag, AttributeSet attributeSet, boolean forceOff)
toggle list formatting on or off for the currently selected text portion.

Switches list display on for the given type, if the selection contains parts not formatted as list or parts formatted as list of another type.

Switches list formatting off, if the selection contains only parts formatted as list of the given type.

Parameters:
  `listTag` - the list tag type to toggle on or off (UL or OL)
  `attributeSet` - the attributes to use for the list to toggle to
  `forceOff` - indicator for toggle operation. If true, possibly existing list formatting inside the selected parts always is switched off. If false, the method decides, if list formatting for the parts inside the selection needs to be switched on or off.

### insertNewTable

public void insertNewTable(int colCount)
Insert a new table.

Parameters:
  `colCount` - the number of columns the new table shall have

### insertAnchor

public void insertAnchor(String anchorName)
apply a new anchor to the currently selected text

If nothing is selected, this method does nothing

Parameters:
  `anchorName` - the name of the new anchor

### insertBreak

public void insertBreak()
insert a line break (i.e. a break for which paragraph spacing is not applied)

### setLink

public void setLink(String linkText, String href, String className)
set a text link at the current selection replacing the selection with a given text.

If nothing is selected, but the caret is inside a link, this will replace the existing link. If nothing is selected and the caret is not inside a link, this method does nothing.

Parameters:
  `linkText` - the text that shall appear as link at the current selection
  `href` - the target this link shall refer to
  `className` - the style class to be used

### setLink

public void setLink(String linkText, String href, String className, String linkImage, Dimension size)
Sets a hyperlink at the current selection, replacing the selection with the given text or image.

Parameters:
  `linkText` - the text to show as link (or null, if an image shall appear instead)
  `href` - the link reference
  `className` - the style name to be used for the link
  `linkImage` - the file name of the image be used for the link (or null, if a text link is to be set instead)
  `size` - the size of the image or null

### removeAnchor

public void removeAnchor(String anchorName)
remove an anchor with a given name

Parameters:
  `anchorName` - the name of the anchor to remove

### insertTableColumn

public void insertTableColumn()
insert a table column before the current column (if any)

### appendTableColumn

public void appendTableColumn()
append a table column after the last column (if any)

### appendTableRow

public void appendTableRow()
Appends a row to a table if the caret is inside a table.

### insertTableRow

public void insertTableRow(String forcedCellName)
Inserts a row to a table, assuming the caret is currently inside a table.

### deleteTableRow

public void deleteTableRow()
delete the row of the table the caret is currently in (if any)

### deleteTableCol

public void deleteTableCol()
delete the column of the table the caret is currently in (if any)

width of adjacent column is adjusted, if there is more than one column in the table. Width adjustment only works, if width attributes of both the column to remove and its adjacent column have the same unit (pt or %).

If there is only one cell or if the caret is not in a table, this method does nothing

Smart border handling automatically sets the left border of a cell to zero, if the cell on the left of that cell has a right border and both cells have no margin. In that case removing the first column will cause all cells of the new first column to have no left border.

### toggleTableHeaderCell

public void toggleTableHeaderCell()
For each cell within the selection, turns a table data cell into a table header cell or vice versa.

### applyTableAttributes

public void applyTableAttributes(AttributeSet a)
apply a set of attributes to the table the caret is currently in (if any)

Parameters:
  `a` - the set of attributes to apply

### applyCellAttributes

public void applyCellAttributes(AttributeSet a, int range)
apply a set of attributes to a given range of cells of the table the caret is currently in (if any)

Parameters:
  `a` - the set of attributes to apply
  `range` - the range of cells to apply attributes to

### goNextCell

public void goNextCell(Element cell)

### goPrevCell

public void goPrevCell(Element cell)

### getCurrentTableCell

public Element getCurrentTableCell()
Gets the table cell at the current caret position.

Returns:
  the Element having the current table cell or null if the caret is not inside a table cell

### getCurrentLinkElement

public Element getCurrentLinkElement()

### getTableCell

public Element getTableCell(int position)
Gets the table cell element at the given position, or null if none.

### getCurrentParagraphElement

public Element getCurrentParagraphElement()
Gets the paragraph element in which the caret is located.

### replaceSelection

public void replaceSelection(String content)

Overrides:
  `replaceSelection` in class `JEditorPane`

### replaceSelection

public void replaceSelection(com.lightdev.app.shtm.HTMLText replacementHTMLText)
Replaces the currently selected content with new content represented by the given `HTMLText`. If there is no selection this amounts to an insert of the given text. If there is no replacement text this amounts to a removal of the current selection. This method overrides replaceSelection in `JEditorPane` for usage of our own HTMLText object.

Parameters:
  `replacementHTMLText` - the content to replace the selection with

### initDnd

public void initDnd()
Initialize the drag and drop implementation for this component.

DropTarget, DragSource and DragGestureRecognizer are instantiated and a MouseListener is established to track the selection in drag operations

this ideally is called in the constructor of a class which would like to implement drag and drop

### dragGestureRecognized

public void dragGestureRecognized(DragGestureEvent event)
a drag gesture has been initiated

Specified by:
  `dragGestureRecognized` in interface `DragGestureListener`

### dragDropEnd

public void dragDropEnd(DragSourceDropEvent event)
this message goes to DragSourceListener, informing it that the dragging has ended

Specified by:
  `dragDropEnd` in interface `DragSourceListener`

### dragOver

public void dragOver(DropTargetDragEvent event)
is invoked when a drag operation is going on

Specified by:
  `dragOver` in interface `DropTargetListener`

### drop

public void drop(DropTargetDropEvent event)
a drop has occurred. If the dragged element has a suitable `DataFlavor`, do the drop.

Specified by:
  `drop` in interface `DropTargetListener`
Parameters:
  `event` - - the event specifying the drop operation
See Also:
  - `DataFlavor`

### dropActionChanged

public void dropActionChanged(DropTargetDragEvent event)
is invoked if the user modifies the current drop gesture

Specified by:
  `dropActionChanged` in interface `DropTargetListener`

### dropActionChanged

public void dropActionChanged(DragSourceDragEvent event)
is invoked when the user changes the dropAction

Specified by:
  `dropActionChanged` in interface `DragSourceListener`

### dragEnter

public void dragEnter(DropTargetDragEvent event)
is invoked when you are dragging over the DropSite

Specified by:
  `dragEnter` in interface `DropTargetListener`

### dragExit

public void dragExit(DropTargetEvent event)
is invoked when you are exit the DropSite without dropping

Specified by:
  `dragExit` in interface `DropTargetListener`

### dragEnter

public void dragEnter(DragSourceDragEvent event)
this message goes to DragSourceListener, informing it that the dragging has entered the DropSite

Specified by:
  `dragEnter` in interface `DragSourceListener`

### dragExit

public void dragExit(DragSourceEvent event)
this message goes to DragSourceListener, informing it that the dragging has exited the DropSite

Specified by:
  `dragExit` in interface `DragSourceListener`

### dragOver

public void dragOver(DragSourceDragEvent event)
this message goes to DragSourceListener, informing it that the dragging is currently occurring over the DropSite

Specified by:
  `dragOver` in interface `DragSourceListener`

### getTransferHandler

public TransferHandler getTransferHandler()

Overrides:
  `getTransferHandler` in class `JComponent`

### removeCharacterAttributes

public void removeCharacterAttributes()

### removeParagraphAttributes

public void removeParagraphAttributes()

### applyAttributes

public void applyAttributes(AttributeSet attributeSet, boolean applyToCompleteParagraph)

### applyAttributes

public void applyAttributes(AttributeSet attributeSet, boolean applyToCompleteParagraph, boolean replace)
Sets the attributes for a given part of this editor. If a range of text is selected, the attributes are applied to the selection. If nothing is selected, the input attributes of the given editor are set thus applying the given attributes to future inputs.

Parameters:
  `attributeSet` - the set of attributes to apply
  `applyToCompleteParagraph` - true, if the attributes shall be applied to the whole paragraph, false, if only the selected range of characters shall have them
  `replace` - true, if existing attributes are to be replaced, false if not

### applyCharacterTag

public void applyCharacterTag(String tag)
(Unfinished.)

### applyParagraphTag

public void applyParagraphTag(String tag, Vector overwritableTags)
Switches the elements in the current selection to the given tag. If allowedTags is non-null, applies the tag only if it is contained in allowedTags. TODO: The new parameter does not work. So the method only works for paragraph tags, like H1, H2 etc. --Dan

Parameters:
  `tag` - the tag name to switch elements to
  `overwritableTags` - Tags that may be overwritten by the new tag.

### getPopup

public JPopupMenu getPopup()

### setPopup

public void setPopup(JPopupMenu popup)

### elementToHTML

public String elementToHTML(Element element)
Returns the string HTML representation of the element.

### tryDefaultKeyStrokeActionWithinCell

public boolean tryDefaultKeyStrokeActionWithinCell(int keyCode, int modifiers, ActionEvent event)
Performs the default key stroke action, assuming that the caret is within a table cell and that the action is a cursor move; if the cursor leaves the current table cell, undoes the action. Returns true if the cursor stayed within the table cell.

### getSelectedText

public String getSelectedText()

Overrides:
  `getSelectedText` in class `JTextComponent`