Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4410123

The usage of DefaultEditorKit.PasteAction causes dialogs appearance

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      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 ----------------------
      ----------------------------------------------------

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            tprinzinsunw Timothy Prinzing (Inactive)
            Reporter:
            sswsunw Ssw Ssw (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: