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

No way to set drag icon: TransferHandler.getVisualRepresentation() is not used

XMLWordPrintable

    • x86
    • windows_2000, windows_xp

      Name: jk109818 Date: 02/11/2003


      FULL PRODUCT VERSION :
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195] SP3

      ADDITIONAL OPERATING SYSTEMS :
      Linux as well


      A DESCRIPTION OF THE PROBLEM :
      For Drag and Drop via the TransferHandler Mechanism,
      The docs state, it should be possible to supply a visual
      representation of the dragged items in a subclass of
      javax.swing.TransferHandler by overriding the method
      public Icon getVisualRepresentation(Transferable t)

      This has no effect. Looking at the source of
      javax.swing.TransferHandler, it is obvious, that
      the internal class javax.swing.TransferHandler.DragHandler
      never uses this. Insetead, it initiates the drag with a
      null-Image.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. get my example from
      http://hh.bonn.iz-soz.de/fetch/TransferHandlerBugs.java
      2. compile, run, open the tree and select something
      3. drag that something around

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      while dragging, the platforms Tree-Leaf Icon should
      accompany the mouse cursor as an iconic representation of
      the dragged items.

      Instead, i only get the (move/copy/link - dependig on
      modifiers) mouse cursor - or on linux the default white block.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      http://hh.bonn.iz-soz.de/fetch/TransferHandlerBugs.java
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      rewriting almost the complete TransferHandler since all
      of the relevant methods/members are private and can not be
      overriden...
      if only the internal classes like SwingTransferHandler were
      not private and could be instanciated by a derived
      TransferHandler...
      (Review ID: 180034)
      ======================================================================

            uta Alexey Utkin (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: