46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
|
package fenetres.create_act;
|
||
|
|
||
|
import java.awt.Toolkit;
|
||
|
import java.awt.datatransfer.Clipboard;
|
||
|
import java.awt.datatransfer.StringSelection;
|
||
|
import java.awt.event.ActionEvent;
|
||
|
import java.awt.event.KeyEvent;
|
||
|
|
||
|
|
||
|
import javax.swing.AbstractAction;
|
||
|
import javax.swing.Action;
|
||
|
import javax.swing.ImageIcon;
|
||
|
import javax.swing.KeyStroke;
|
||
|
|
||
|
import cXML.Run;
|
||
|
import cXML.node;
|
||
|
import fenetres.baliseStyle;
|
||
|
|
||
|
public class actCopy extends AbstractAction{
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
private static final long serialVersionUID = 1L;
|
||
|
{
|
||
|
putValue( Action.NAME, "Copier" );
|
||
|
putValue( Action.SMALL_ICON, new ImageIcon( getClass().getResource("/copy.png") ) );
|
||
|
putValue( Action.SHORT_DESCRIPTION, "Copier (CTRL+C)" );
|
||
|
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK ) );
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void actionPerformed(ActionEvent e) {
|
||
|
node nod = (node) fenetres.create.getSelectNode().getUserObject();
|
||
|
|
||
|
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||
|
|
||
|
StringSelection texto = new StringSelection(Run.ecritureNode(nod, 0).toString());
|
||
|
|
||
|
cb.setContents(texto, texto);
|
||
|
|
||
|
fenetres.create.getTextNodeSelect().setText(baliseStyle.balise()+"<hr><h2>Le node est copié dans le presse papier.</h2><hr>");
|
||
|
}
|
||
|
|
||
|
}
|