org.xhtmlrenderer.swing
Class SelectionHighlighter
java.lang.Object
org.xhtmlrenderer.swing.SelectionHighlighter
- All Implemented Interfaces:
- MouseListener, MouseMotionListener, EventListener
public class SelectionHighlighter
- extends Object
- implements MouseMotionListener, 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
listenerList
protected EventListenerList listenerList
changeEvent
protected transient ChangeEvent changeEvent
copyAction
public static final String copyAction
- See Also:
- Constant Field Values
SelectionHighlighter
public SelectionHighlighter()
addChangeListener
public void addChangeListener(ChangeListener l)
removeChangeListener
public void removeChangeListener(ChangeListener l)
fireStateChanged
protected void fireStateChanged()
install
public void install(XHTMLPanel panel)
deinstall
public void deinstall(XHTMLPanel panel)
setDot
public void setDot(SelectionHighlighter.ViewModelInfo pos)
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDragged in interface MouseMotionListener
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMoved in interface MouseMotionListener
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClicked in interface MouseListener
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEntered in interface MouseListener
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExited in interface MouseListener
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressed in interface MouseListener
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleased in interface MouseListener
getComponent
public XHTMLPanel getComponent()
moveCaret
protected void moveCaret(MouseEvent e)
selectAll
public void selectAll()
moveDot
public void moveDot(SelectionHighlighter.ViewModelInfo pos)
normalizeSpaces
public String normalizeSpaces(String s)
getSelectionRange
public org.w3c.dom.ranges.Range getSelectionRange()
adjustVisibility
protected void adjustVisibility(Rectangle nloc)
convertMouseEventToScale
protected MouseEvent convertMouseEventToScale(MouseEvent e)
setHandler
public void setHandler(TransferHandler handler)
Copyright © 2013. All Rights Reserved.