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

JTextField.copy() throws HeadlessException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs

      Description



      Name: sdR10048 Date: 01/25/2001


      public void javax.swing.JTextField.copy()
      throws unexpected HeadlessException in headless mode.

      Javadoc says:
      --------------------------------------------------
      public void copy()

           Transfers the currently selected range in the associated text
           model to the system clipboard, leaving the contents in the text
           model. The current selection remains intact. Does nothing for
           null selections.
           See Also:
               Toolkit.getSystemClipboard(), Clipboard

      See example:
      --------------------------------------------------
      dsv@falcon ~/tmp
      % cat Test.java
      public class Test {
          public static void main(String[] args) {
              (new javax.swing.JTextField()).copy();
          }
      }

      dsv@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)

      dsv@falcon ~/tmp
      % javac Test.java

      dsv@falcon ~/tmp
      % java -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 Test.main(Test.java:3)
      ^C
      --------------------------------------------------
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                shickeysunw Shannon Hickey (Inactive)
                Reporter:
                dsvsunw Dsv Dsv (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: