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

TransferHandler.getSourceActions() returns COPY instead of NONE action

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: auR10023 Date: 01/10/2001


                                                                                                       
      Method javax.swing.TransferHandler.getSourceActions(JComponent c) returns
      TransferHandler.COPY instead of TransferHandler.NONE when JComponent c does
      not contain necessary property.
                                                                                                       
      The javadoc says:
                                                                                                       
      ...
                                                                                                       
           Returns:
                This is implemented to return COPY if the transfer property can be found, otherwise
                NONE is returned. A return value of NONE disables any transfers out of the component.
      ...
                                                                                                       
      Here is the example:

      ---t.java---

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import java.util.*;

      public class t{
          public static void main(String [] args) {
              TransferHandler testHandler = new TransferHandler("stringProperty");
              JComponent c = new TestComp();
              if (testHandler.getSourceActions(c) == TransferHandler.NONE) {
                  System.out.println("Returns NONE");
              } else if (testHandler.getSourceActions(c) == TransferHandler.COPY) {
                  System.out.println("Returns COPY");
              }
          }
      }

      class TestComp extends javax.swing.JComponent
          implements java.io.Serializable {
          public TestComp() {
          }
      }

      -----output-----
                                                                                                       
      Returns COPY
                                                                                                       
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: