In merlin, cut/copy/drag are broken for JEditorPane when its EditorKit is an RTFEditorKit. Thus, setting the content-type to "text/rtf" or explicitly setting the EditorKit to an RTFEditorKit will prevent cut/copy/drag from working.
To see the problem, compile and run the following:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class EditorPaneRTFTest extends JFrame {
JEditorPane ep = new JEditorPane();
public EditorPaneRTFTest() {
setTitle("EditorPaneRTFTest");
setSize(500, 400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);
ep.setContentType("text/rtf");
try {
ep.getDocument().insertString(0, "Try copying or moving this.", null);
} catch (BadLocationException ble) {
}
ep.setDragEnabled(true);
getContentPane().add(new JScrollPane(ep), BorderLayout.CENTER);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
EditorPaneRTFTest test = new EditorPaneRTFTest();
test.setVisible(true);
}
});
}
}
Try copying the text (CTRL-C) - nothing is copied to the clipboard.
Try cutting the text (CTRL-X) - nothing is put on the clipboard and no text is removed.
Try dragging and dropping the text - the drag and drop completes and no text is transferred.
The expected result is that plain text should be moved/copied around.