|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.event.MouseAdapter
uk.ac.starlink.util.gui.StringPaster
public abstract class StringPaster
Utility class to facilitate actions when a string is pasted into a
component. If you select some text on a windowing system it's possible
to paste it into a JTextComponent which is a convenient way
of saving typing.
Implementing this for other components is rather fiddly - this
class does the hard work for you. To use it, implement the abstract
pasted(java.lang.String)
method and add it to the component you want to act on
using Component.addMouseListener(java.awt.event.MouseListener)
.
Constructor Summary | |
---|---|
StringPaster()
|
Method Summary | |
---|---|
protected Toolkit |
getToolkit()
Returns the Toolkit holding the selection. |
protected boolean |
isPasteEvent(MouseEvent evt)
Determines whether a mouse event counts as a paste. |
void |
mouseClicked(MouseEvent evt)
Invokes pasted(java.lang.String) if appropriate. |
protected abstract void |
pasted(String str)
Invoked when a paste event occurs. |
Methods inherited from class java.awt.event.MouseAdapter |
---|
mouseEntered, mouseExited, mousePressed, mouseReleased |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringPaster()
Method Detail |
---|
public void mouseClicked(MouseEvent evt)
pasted(java.lang.String)
if appropriate.
mouseClicked
in interface MouseListener
mouseClicked
in class MouseAdapter
protected boolean isPasteEvent(MouseEvent evt)
evt
- mouse event
protected Toolkit getToolkit()
protected abstract void pasted(String str)
str
- a string that has been pasted from the
system-wide selection
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |