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

DefaultEditorKit.CopyAction.actionPerformed throws HeadlessException

XMLWordPrintable



      Name: sdR10048 Date: 01/26/2001


      public void
        javax.swing.text.DefaultEditorKit.CopyAction.actionPerformed(ActionEvent)
      throws unspecified HeadlessException in headless mode.

      Javadoc says:
      --------------------------------------------------
      public void actionPerformed(ActionEvent e)

           The operation to perform when this action is triggered.
           Parameters:
                e - the action event

      See example:
      --------------------------------------------------
      [falcon] ~/tmp
      % cat Test.java
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.text.*;
      import javax.swing.text.DefaultEditorKit.*;

      public class Test {
          public static void main(String args[]) {
              CopyAction action = new CopyAction();
              JTextArea comp = new JTextArea();
              ActionEvent event = new ActionEvent(comp, 0, "");
              action.actionPerformed(event);
          }
      }

      [falcon] ~/tmp
      % javac Test.java

      [falcon] ~/tmp
      % j -Djava.awt.headless=true Test
      Exception in thread "main" java.awt.HeadlessException
              at sun.awt.HeadlessToolkit.getSystemClipboard(HeadlessToolkit.java:278)
              at javax.swing.TransferHandler$TransferAction.getClipboard(TransferHandler.java:735)
              at javax.swing.TransferHandler$TransferAction.actionPerformed(TransferHandler.java:716)
              at javax.swing.text.JTextComponent.copy(JTextComponent.java:1056)
              at javax.swing.text.DefaultEditorKit$CopyAction.actionPerformed(DefaultEditorKit.java:1184)
              at Test.main(Test.java:11)
      ^C
      [falcon] ~/tmp
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b48)
      Java HotSpot(TM) Client VM (build 1.4beta-B48, mixed mode)
      --------------------------------------------------
      ======================================================================

      Name: sdR10048 Date: 01/26/2001


      NOTE: the following methods have the same problem:
      javax.swing.text.DefaultEditorKit.CutAction.actionPerformed(ActionEvent)
      javax.swing.text.DefaultEditorKit.PasteAction.actionPerformed(ActionEvent)


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

            tprinzing Tim Prinzing
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: