-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta
-
sparc
-
solaris_2.6
Name: ssR10000 Date: 01/31/2001
The usage of DefaultEditorKit.PasteAction causes unexpected dialogs appearance.
The method DefaultEditorKit.PasteAction.actionPerformed show unexpected dialog box.
But javadoc says nothing about any windows or dialogs. This dialog is unnecessary
and should be removed.
May be this problem DefaultStyledDocument or JTextArea classes.
See example for more info.
---------------------- example ---------------------
import javax.swing.text.*;
import javax.swing.*;
import java.awt.Frame;
import java.awt.event.ActionEvent;
public class Test {
public static void main(String argv[]) {
DefaultEditorKit.PasteAction action = new DefaultEditorKit.PasteAction();
JTextComponent comp = new JTextArea();
Document doc = new DefaultStyledDocument();
try {
doc.insertString(0, "The test string", null);
} catch (BadLocationException e) {
System.out.println("Unexpected in insertString:" + e);
}
comp.setDocument(doc);
comp.selectAll();
ActionEvent event = new ActionEvent(comp, 0, "The text passed via the event.");
action.actionPerformed(event);
String content = null;
try {
content = doc.getText(0, doc.getLength());
} catch (BadLocationException e) {
System.out.println("Unexpected in getText:" + e);
}
System.exit(0);
}
}
---------------------- output ----------------------
----------------------------------------------------
======================================================================