Drop Target Registration

I am using DnD to drag items from a JTree (drag source) onto another JTree (drop target). This all takes place within a JPanel enclosing a JSplitPane. It works fine when I run this class using a main(), creating a JFrame within the main() and adding the DnD JPanel. When I add this component into the application the Drop Target doesn't seem to get registered. I can't get any of the methods in the DropTargetListener I/F to fire. As a result, invoking the getDropSuccess() method on the DragSourceDropEvent object in the dragDropEnd() method of the my DragSourceListener always returns false.
The new DropTarget(component, myDropTargetListener) call returns a non-null object so I assume it's getting registered. Help!!

This problem was introduced by the IDE. VisualAge prohibits applications from registering DropTargetListeners in the context of a large application.
kduell@altawave

Similar Messages

  • Can we restrict Page assets shown in Content Finder to match available cq drop targets?

    We have defined a component that accepts drag-and-drop of user content, and the cq:DropTargetConfig node (under cq:editConfig > cq:dropTargets) defines groups=[page] because it accepts assets of type cq:Page not images.  Our component is a copy of the /libs/foundation/components/image component, because it accepts drag-and-drop, and we modified its innards to accept cq:Page not image.  Seems that the 'accept' property is completely ignored when groups=[page], I think 'accept' is only processed when groups=[media] i.e. images.
    This is basically working fine except there is so much user content that it is time-consuming for users to select the right pages to drag from the Content Finder extension into the drag-and-drop target.  And if they pick the wrong kind of asset it can really mess up the target page.  There are so many types of components based on cq:Page and many of them just do not belong in this particular drop target, but if the user drags an inappropriate asset into our drop target then cq allows it, often with disastrous results (content properties and nodes get overwritten in the wrong place, etc).
    Yes the Content Finder has a search bar but really I would like to restrict the list of assets shown there without the user having to type in a search term.  I hope there is something for Page-based content analogous to the 'allowedPaths' property in a Template.  In the WCM when you click New Page at some jcr path, a template-chooser dialog comes up and it only has templates which are allowed for that jcr path, so the dialog is uncluttered and guides the user to a relevant template.  Similarly, Components have an 'allowedParents' property so you can't use them where they don't belong.  Please advise if there is something similar to make it easier to find relevant content in Content Finder tab Pages.

    I just checked this behavior. In CQ 5.5, an image dropped in an image component OEM is trunct'ed to fit the column or parsys that it is added to. The image remains 100% full-scale and flush left. In the past as a CQ architect, I have participated in the conversation no less than 10 times. If fact I discussed this with a client last week. They insisted on being able to use renditions as part of content.
    I've advised on various solutions. The most complex solution I've advised on will autosize the image component to fit the column it is used in without author intervention. This is, however, predicated on the column components to be rewritten using a grid system and not %. It's extremely complex and changes the behavior of various components dramatically.
    I agree I don't fully understand or embrace the philosophy on this one. I see the purist attitude toward renditions of images but its not practical in the field. Under the current philosophy images of the same size and scale will be cached in multiple locations.
    Lars, feel free to school us on this one... it's your baby.

  • Flash drop target problem in Captivate

    I realise that this is more a Flash-specific question, but I thought I'd give the Captivate forum a try as it relates to a Captivate lesson I am trying to put together.
    I have an interactive exercise that I have produced in Flash CS4 (Actionscript 2), that involves the user dragging and dropping movieclips onto specific drop targets. 
    It works fine when run on its own/in a browser etc, but when I insert the movieclip into Captivate to incorporate it into the lesson, the drag/drop functionality doesn't work as it should do anymore (drag/drop still works, but the dropped mc's no longer react to being dropped on the correct targets.)
    I'm wondering if this is because Captivate outputs the lesson as an .SWF, so my Flash clip is within a 'container' consisting of the actual Captivate e-learning package itself?
    Unfortunately my knowledge of Flash and Captivate is still in its infancy, so any help would be greatly appreciated from anyone with experience of using Flash within Captivate.
    Thanks.

    Hi kglad,
    Thanks for your quick reply.  I'm little confused though - this is the line of code I'm suspecting I need to change: -
    if (GetProperty ("/Ref_out", _droptarget) eq "/Ref_in") {
    Ref_out being the dragged object, Ref_in being the drop target mc.  How would I go about using the _name property instead?
    Sorry for the stupid question, but I'm struggling to find my way around the Adobe help files on the web - I don't think they're particularly user friendly, but maybe that's just me.

  • Drag and Drop Interaction with 50+ Drop Targets

    Hello,
    I'm fairly new to Captivate 7 but very familiar with Flash. I'm tasked with a project that I would like to do with the drag and drop interaction widget from Captivate 7. Basically, we need our learners to identify the locations of our resorts on a map. Select the name of the resort, drag and drop it in the city/state or country where located. My question is can Captivate handle this task? To me, it seems as a large task for Captivate to handle, and so I was thinking of coding it in Flash.
    Here is what I need:
    1.- List of all the properties at bottom with the drop target being a map of the US or world and have the location for each property as the drop target.
    2.- When the resort/property is selected, the name will change to the three letter code. Example: New York City, when clicked = NYC and the map itself to reflect the 3 letter code once dropped on the map if correct.
    3. If incorrect, the listed item will revert to the long name and return to the list.
    4. If this can be graded, it would be best.
    I can break the project into different regions but if I wanted to keep all 300+ properties in one module, will it be an issue? At the very least, I would need to do a minimum of about 50 per module.
    Thanks all! I've found this forum to be extremely helpful and the members seem to be eager to help.

    var matchingTargetName:String =(event.target.name).substring(0, 1);
    Change the name of the target to A and B and the mc A1, A2, A3, A4... and B1, B2,B3...

  • Image as drop target for drag and drop

    was wondering how I can make an image to be a drop target using the dnd api. so far from what i've seen it takes only java components to be target, so if anyone has any ideas it will be great.
    thanks

    I don't know why your DropTarget implementation doesn't work, but an alternative, more high-level way of doing what you want is to use a TransferHandler:
            canvas.setTransferHandler(new TransferHandler() {
                @Override
                public boolean canImport(TransferSupport support) {
                    if (support.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                        support.setDropAction(DnDConstants.ACTION_COPY);
                        return true;
                    return false;
                @Override
                public boolean importData(TransferSupport support) {
                    try {
                        String text = (String) support.getTransferable().getTransferData(DataFlavor.stringFlavor);
                        System.out.println(text);
                        return true;
                    catch (Exception ex) {
                        ex.printStackTrace();
                        return false;
            });

  • My drag images disappear when they are dropped on a correct drop target during the drag and drop interaction.

    What am I missing. The opacity is at 100%. The drop target is a highlighted box from objects. I am using Captivate 8.

    Hi there,
    You might want to make sure your Depth setting is not set to Back instead of Front on your drop target(s).
    The Depth setting is accessed via the Drag and Drop window/panel under Format setting while you have your drop target selected.
    If your Depth setting is set to Back, especially if your opacity is set to 100% on your highlight box/drop target, your drag image would go behind your drop target giving the effect of disappearing behind your highlight box - especially if the drop target is larger than the drag image.

  • Drop target size/orientation with skinned List changed from 4.0 to 4.5

    I have a project that we recently moved from Flex/Flash Builder 4 to 4.5.  We have a skinned list with a horizontal orientation with the items in the list skinned with a button skin.  The user is allowed to drag buttons from a list of available items into another list of items they want.  When compiled in 4 with the 4.1 SDK, the drop area was the entire list area on the screen (it will hold about 5 of the buttons).  In 4.5, the drop area is only the width of 1 button, and appears to go down vertically instead of to the right horizontally.  If I extend the size of the list vertically, I can drop in any vertical position below the 'first' position, but cannot go to the right of the first position  to drop.
    It appears that whatever is computing the drop target area for the list is not honoring the layout of the list - it appears to always set up the drop area vertically.
    Again, all of this worked as expected in 4.1, it is only after compiling in 4.5 that this started.
    In addition, I had to add a call to event.stopImmediatePropagation() in the drop event handler, or else the item was added to the 'I want this' list 2x - I'm guessing 1x in my handler, and 1 additional time in a new 'automatic' drop handler for spark lists.
    Any idea how to fix the drop area?  It is very annoying for the users.
    Mark

    Never mind, found the problem.
    In our application, we also added a new menu and navigation bar.  The navigation bar has a 'history' panel that when you click on it, it 'swings down' and the user can click prior navigation points to return to.  This history panel, even though hidden with 'visible = false', was still blocking the drop area.  We had to set the history panel 'enabled = false' as well as 'visible = false' when it is not on the screen.  Once this was changed,  it quit blocking the drop area.  I found it when testing a different drag target that also fell under the 'history panel' area.

  • Flex 4.6 Drag and Drop: an event that fires when dropped on invalid drop target?

    Is there an event or condition somewhere in the DragManager to differentiate between an item that is eitther dropped on an invalid  or a valid drop target?
    I need to re-populate data to the original container after the drop has occured, however i can't seem to find any event or condition that would indicate if the dragged item was dropped on a valid or invalid target? Thanks in advance.

    Older machine = Windows XP
    Newer = Windows Vista

  • Drop target below image or canvas seems impossible?

    Hi All!
    I am building an app where the user can drag an image from
    one place, and drop it in a few different locations.
    The drop locations are vector images who listen for the
    dragEnter event, they get "highlighted" when an image is dragged
    onto them, and then accepts the dropped image - no problem. This
    all works like a charm.
    The trouble is I need to add a partially transparent PNG
    image on top of it all, and when I do that the image seems to
    consume any dragEnter events that are generated, and the "drop
    spots" below never get notified that something is being dragged
    over them.
    I realize that a PNG image with transparency will not be
    considered TRULY transparent, and that it normally does consume
    mouse events regardless of wether it's transparent or not. The odd
    thing is that you cannot work around this by setting mouseEnabled
    and mouseChildren to false on the image - it still sits there
    effectively blocking the dragEnter events from reaching their
    intended targets.
    If anyone has a workaround or solution to this I'd be very
    grateful!
    Thanks in advance & Best regards
    Culme

    I had to give up on this one for now.
    I created a layer on top which contains the "drop targets",
    and a layer below the PNG image which contains the visual elements
    that get highlighted when stuff is dragged over the drop targets.
    It works, but it seems like a rather lousy solution.
    If anyone figures out a better way of doing it I'm still
    interested.

  • Making a JList as a Drop target for 2 drop features

    Hi there, would like to ask wat condition do i check for if I wan to make a JList a Drop target for 2 features. One of which come from another JList... the other is drag and drop internally(Reshuffling of Position)... would like to get it as soon as possible.. thanks!!!!

    through event's source, definately you have two JList instances extended by JList, so just check event source instance.

  • How do I make drag sources disappear after being moved to the correct drop target in Captivate 7

    How do I make drag sources disappear after being moved to the correct drop target in Captivate 7

    Thank you so much. I could have searched a very long time and not found that. It is counter-intuitive to me that I would set the behavior for the drag source on the properties for the drop target.

  • JTree Drop Target Highlighting while dragging

    Hi All,
    I am having this requirement where I need to develop a similar interface as that of the Windows Explorer. I am facing problems in the JTree where one of the requirements say that I need to be able to highlight(select) a node when it is dragged upon although that might not be the drop target, very similar to Windows Explorer where while dragging a folder, even before dropping the folder on a target folder the drag selects all the nodes over which the drag moves.
    Also I need to be able to get a ghost image of the item being dragged, very similar to that of Windows explorer.
    If anybody out there knows how to achieve this Please help.
    Regards,
    Kumar GHH

    In the dragGestureRecognized (DragGestureEvent dge) method I am trying to set the cursor from default drag cursor to move cursor. But the move cursor is showing along with the default cursor with flickering. While dragging the image I just want to show the move cursor only.

  • Determining drop target with TransferHandler

    Is there an easy way to determine the drop target
    from within the exportDone() method of TransferHandler?
    Details:
    I implemented a TransferHandler to handle DND from
    a JList to the same JVM or to a different (Motif)
    application.
    By default, if the drag & drop is to the same JVM I
    want to MOVE, if the drop is in another application
    I want to COPY (so my JList stays the same).
    I implemented the MOVE/COPY in exportDone(), but this
    has no (immediate) way of determining where the data
    was dropped (ie, same JVM or non-local) so I had to
    hack something involving createTransferable(),
    importData() and exportDone() to implement same.
    Any suggestions as to how I can easily determine where
    the data was dropped from exportDone()?
    Thanks, Joe

    I eventually cheated and put a static variable in the class that launches my application. There seems to be some deficiencies in the TransferHandler process. I also can't manage to figure out what TreePath in a JTree the data was dropped on.
    I may have to go back to the old 1.3 way of doing things.

  • Drag n drop exception - drop target listener

    It seems several people are having a problem with the built in drop target listener. See the (second part of) thread linked below (was mistakenly put in AWT forum).
    http://forum.java.sun.com/thread.jspa?messageID=2905780&
    ANY help would be much appreciated.

    Can anyone please help with this? No one seems to understand it. I get the following exception when dragging outside of a JTable:
    java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicTableUI$TableDropTargetListener.restoreComponentState(BasicTableUI.java:1216)
         at javax.swing.plaf.basic.BasicDropTargetListener.dragExit(BasicDropTargetListener.java:249)
         at javax.swing.TransferHandler$SwingDropTarget.dragExit(TransferHandler.java:586)
         at sun.awt.dnd.SunDropTargetContextPeer.processExitMessage(SunDropTargetContextPeer.java:385)
         at sun.awt.dnd.SunDropTargetContextPeer.access$700(SunDropTargetContextPeer.java:52)
         at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchExitEvent(SunDropTargetContextPeer.java:792)
         at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:740)
         at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:29)
         at java.awt.Component.dispatchEventImpl(Component.java:3494)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:3315)
         at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:3261)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3123)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    I get similar exception when dragging within a JList (except the NPE is in BasicTableUI$TableDropTargetListener.updateInsertionLocation). I'm using the provided StringSelection as my Transferable. The exceptions disappear when I disable the look and feel options in my app.
    PLEASE HELP. I'm so confused/frustrated by this.
    THANK YOU in advance.

  • DnD with 2D scaled drop target

    This is more a strategy question than a code question - although code examples will be muchly appreciated.
    I have a model drawing component (ModelDrawingComponent extends JInternalFrame) that contains child components ( ie. ClassNode extends JInternalFrame). I need to be able to drop information into the child component (ClassNode). My description is greatly simplified leaving out several layers such as JScrollPanes, JPanels, etc.
    I have overridden the main JPanel's paintComponent() method to allow 2D drawing of lines and scale transformations of the entire model component resultant view. To provide mouse event interactions for this I use a GlassPane which transforms the mouse point to a scaled component adjusted point.
    My problem is implementing a DropTarget for Drag and Drop with 2D scaling - the mouse gestures reference points that are not adjusted for the scaling. So I need to transform the point geometry to determine whether the drag is over one of the ClassNode components.
    Does anyone have experience with DnD and 2D transformed targets they would like to share - ie. what is the best strategy for managing the transformation of the current drag point to the transformed / scaled point? I am assuming that the DropTarget should be the GlassPane. If so, how do you manage only showing a Drop OK Cursor when the cursor is over a child (ie. ClassNode) instead of over the GlassPane? What event listeners do I need to override to accomplish this?
    Thanks in advance.

    I don't know why your DropTarget implementation doesn't work, but an alternative, more high-level way of doing what you want is to use a TransferHandler:
            canvas.setTransferHandler(new TransferHandler() {
                @Override
                public boolean canImport(TransferSupport support) {
                    if (support.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                        support.setDropAction(DnDConstants.ACTION_COPY);
                        return true;
                    return false;
                @Override
                public boolean importData(TransferSupport support) {
                    try {
                        String text = (String) support.getTransferable().getTransferData(DataFlavor.stringFlavor);
                        System.out.println(text);
                        return true;
                    catch (Exception ex) {
                        ex.printStackTrace();
                        return false;
            });

Maybe you are looking for