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(); String textNodes = Run.ecritureNode(nod, 0).toString().replace("\t","").replace("\r", "").replace("\n", ""); StringSelection texto = new StringSelection(textNodes); cb.setContents(texto, null); System.out.println(texto.toString()); fenetres.create.getTextNodeSelect().setText(baliseStyle.balise()+"