dcsimg
filtered copy and paste
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   marian_dreedz
Posted On:   Wednesday, October 3, 2001 06:31 AM

Hi people I have code that is working for styled copy and paste. I need to know how I can filter (remove) all the from the selected text before i paste it. Here is a snippet of the paste code. The problem is how do I remove in ElementSpec[] specs public void actionPerformed(ActionEvent e) { if (m_monitor != null) { Clipboard clipboard = m_monitor.getToolkit().getSystemClipboard(); Transferable content =clipboard.getContents(this); if (content != null) { if ( content.isDataFlavorSupported( StyledStringSelection.styledFlavor)) { try { ElementSpec[] specs = (ElementSp}ec[])(content.getTransferData(Sty   More>>

Hi people I have code that is working for styled copy and paste. I need to know how I can filter (remove) all the
from the selected text before i paste it. Here is a snippet of the paste code. The problem is how do I remove
in ElementSpec[] specs


public void actionPerformed(ActionEvent e) {


			
if (m_monitor != null) {

Clipboard clipboard =

m_monitor.getToolkit().getSystemClipboard();

Transferable content =clipboard.getContents(this);

if (content != null) {

if ( content.isDataFlavorSupported(
StyledStringSelection.styledFlavor)) {

try {
ElementSpec[] specs = (ElementSp}ec[])(content.getTransferData(StyledStringSelection.styledFlavor));


Caret caret = m_monitor.getCaret();

MyStyledDocument doc = (MyStyledDocument)

m_monitor2.getDocument();

doc.replaceSelection(caret, specs);

} catch
(Exception exc) {

m_monitor.getToolkit().beep();

}

} else if ( content.isDataFlavorSupported(
DataFlavor.stringFlavor))
{
try {

String dstData = ((String)content.getTransferDataDataFlavor.stringFlavor)).replace('
','@');


m_monitor2.replaceSelection(dstData);

} catch (Exception exc) {

m_monitor2.getToolkit().beep();

}

} else {

m_monitor2.getToolkit().beep();

}


}

   <<Less
About | Sitemap | Contact