Aquí el código mas importante:
Código
import javax.swing.text.DefaultEditorKit;
public class EjGui extends javax.swing.JFrame {
private void initComponents() {
jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem4.setText("Copiar");
jMenuItem4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenuItem4MouseClicked(evt);
}
});
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
copiar(evt);
}
});
private void copiar(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jMenuItem4MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
private javax.swing.JMenuItem jMenuItem4;
Intente hacer un:
Código
jMenuItem4.setAction(new DefaultEditorKit.CopyAction());Dentro del método copiar y nada.
Saludos.










Autor


En línea


