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'sDefaultCaret| Modifier and Type | Class and Description |
|---|---|
static class |
SelectionHighlighter.CopyAction |
class |
SelectionHighlighter.ViewModelInfo |
| Modifier and Type | Field and Description |
|---|---|
protected ChangeEvent |
changeEvent |
static String |
copyAction |
protected EventListenerList |
listenerList |
| Constructor and Description |
|---|
SelectionHighlighter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(ChangeListener l) |
protected void |
adjustVisibility(Rectangle nloc) |
protected MouseEvent |
convertMouseEventToScale(MouseEvent e) |
void |
deinstall(XHTMLPanel panel) |
protected void |
fireStateChanged() |
XHTMLPanel |
getComponent() |
org.w3c.dom.ranges.Range |
getSelectionRange() |
void |
install(XHTMLPanel panel) |
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
protected void |
moveCaret(MouseEvent e) |
void |
moveDot(SelectionHighlighter.ViewModelInfo pos) |
String |
normalizeSpaces(String s) |
void |
removeChangeListener(ChangeListener l) |
void |
selectAll() |
void |
setDot(SelectionHighlighter.ViewModelInfo pos) |
void |
setHandler(TransferHandler handler) |
protected EventListenerList listenerList
protected transient ChangeEvent changeEvent
public static final String copyAction
public void addChangeListener(ChangeListener l)
public void removeChangeListener(ChangeListener l)
protected void fireStateChanged()
public void install(XHTMLPanel panel)
public void deinstall(XHTMLPanel panel)
public void setDot(SelectionHighlighter.ViewModelInfo pos)
public void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenerpublic void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic XHTMLPanel getComponent()
protected void moveCaret(MouseEvent e)
public void selectAll()
public void moveDot(SelectionHighlighter.ViewModelInfo pos)
public org.w3c.dom.ranges.Range getSelectionRange()
protected void adjustVisibility(Rectangle nloc)
protected MouseEvent convertMouseEventToScale(MouseEvent e)
public void setHandler(TransferHandler handler)
Copyright © 2021. All rights reserved.