org.xhtmlrenderer.swing
Class SelectionHighlighter
java.lang.Object
org.xhtmlrenderer.swing.SelectionHighlighter
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
public class SelectionHighlighter
- extends java.lang.Object
- implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener
A simple Selection and Highlighter class for
XHTMLPanel
.
The current selection is available as a DOM Range via getSelectionRange. There is also a Swing
action to copy the selection contents to the clipboard:
SelectionHighlighter.CopyAction
, which
should be installed on the SelectionHighlighter
Usage: create the XHTMLPanel, create an instance
of this class then call install. See also:
/demos/samples/src/SelectionHighlighterTest.java
With thanks to Swing's DefaultCaret
- Author:
- Nick Reddel
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
copyAction
public static final java.lang.String copyAction
- See Also:
- Constant Field Values
SelectionHighlighter
public SelectionHighlighter()
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
install
public void install(XHTMLPanel panel)
deinstall
public void deinstall(XHTMLPanel panel)
setDot
public void setDot(SelectionHighlighter.ViewModelInfo pos)
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
getComponent
public XHTMLPanel getComponent()
selectAll
public void selectAll()
moveDot
public void moveDot(SelectionHighlighter.ViewModelInfo pos)
normalizeSpaces
public java.lang.String normalizeSpaces(java.lang.String s)
getSelectionRange
public org.w3c.dom.ranges.Range getSelectionRange()
Flying Saucer Project Home