Drag and Drop issue in Jlist - Transferhandler not working

Hi all,
I have a problem associated with the drag and drop of components into a Jlist.
When I drag component out of a Jlist, the control reaches inside transfer handler, but when I try to insert a component into the Jlist, the control does not reach inside Jlist transfer handler.
     jlist.setDropMode(DropMode.INSERT);
     jlist.setDragEnabled(true);
     jlist.setTransferHandler(new TransferHandler()
               List fileList;
               boolean export = false;
               List<File> newList = null;
               protected Transferable createTransferable(JComponent c)
                    System.out.println("inside handler");
                                ..............................Please help me with this issue.
Any help in this regard will be well appreciated with dukes.
Regards,
Anees

AneesAhamed wrote:
Hi all,
I have a problem associated with the drag and drop of components into a Jlist.
When I drag component out of a Jlist, the control reaches inside transfer handler, but when I try to insert a component into the Jlist, the control does not reach inside Jlist transfer handler.
jlist.setDropMode(DropMode.INSERT);
jlist.setDragEnabled(true);
jlist.setTransferHandler(new TransferHandler()
               List fileList;
               boolean export = false;
               List<File> newList = null;
               protected Transferable createTransferable(JComponent c)
                    System.out.println("inside handler");
..............................Please help me with this issue.
Any help in this regard will be well appreciated with dukes.If you're wondering why your createTransferable() method is not called when you drag from some other component and drop into the list it is because createTransferable() is called when you start dragging. So it would be the TransferHandler of the source component, not your target list, that has its createTransferable() called in that case.
When the list is the target of a drag&drop you should see the canImport() method of your TransferHandler being called. Do a System.out(0 in that method as well and see if that is the case.

Similar Messages

  • Drag and drop issues.  I'm not alone.

    So clearly I'm not the only one dealing with this, I've seen other topics with people running into this problem.
    All of a sudden last night I was unable to drag and drop stuff around, copy and past, run a new program and I have no Spotlight. I've restarted Finder, the whole Mac, reset the PRAM, and even rand DU and repaired the disk. Nothing. Stil can't do stuff on it, and it's starting to get on my nerves.
    Does anyone know of a solution to this? I've read many "temporary fixes" that haven't done anything for me.
    Thanks!

    Inaki wrote:
    So clearly I'm not the only one dealing with this, I've seen other topics with people running into this problem.
    All of a sudden last night I was unable to drag and drop stuff around, copy and past, run a new program and I have no Spotlight. I've restarted Finder, the whole Mac, reset the PRAM, and even rand DU and repaired the disk. Nothing. Stil can't do stuff on it, and it's starting to get on my nerves.
    When you say, "All of a sudden" what were you doing on the computer? Do you have any 3rd party software installed. Any recent installs?
    Does anyone know of a solution to this? I've read many "temporary fixes" that haven't done anything for me.
    Create a new user and see if the problem exists with the new user. If not, then you most likely have a corrupted .plist or other file.
    If the problem exists with the new user, then it's a deeper issue - more system related.
    Your topic is a bit misleading - you have multiple issues - spotlight and the inability to run a new program. Is it possible that this new program is the problem?
    Message was edited by: nerowolfe

  • Drag and Drop operation of SWT is not working in windows 7

    I have created VB script to elevate all administrator permissions to user and launched my application but not able to drop image to label in my application on Windows 7. It works fine if I remove User Account Setting (UAC). Please help how I can solve it.

    WTF? What are you talking about?
    Drag and drop of what from where to where does not work how?
    - What are you dragging?
    - From Where?
    - To Where?
    - What do you expect to happen?
    - What happens?
    - Why do you expect that to happen?
    - What technologies are you using?
    Basically, read [_How To Ask Questions The Smart Way_|http://www.catb.org/~esr/faqs/smart-questions.html].

  • Drag and drop from Contacts into Numbers not working - any solutions?

    I'm trying to get my Contacts into a Numbers spreadsheet. According to the Help files, I should be able to select the Contacts and simply drag them into a Numbers sheet (after deleting the default Table).  I've tried this many times over and the drag and drop feature doesn't seem to be working.  I can select the contacts and drag them over, but the little contact card remains red when I drag it into Numbers and never turns green to allow me to drop into Numbers. It's the same whether I'm trying to drag one contact or many contacts at the same time. I've also tried exporting a vcard and then dragging that file from my desktop into Numbers, but that doesn't work either.  I've tried quitting and reopening both applications, as well as restarting my computer.  I'm running OSX 10.8.3 and have installed all new software updates, so I'm just at a loss for what to try next. 
    Does anyone have any solutions for this problem, or an alternative way to get my Contacts into a Numbers file?
    Many thanks in advance!

    When I tried, it put up a dialog asking me if I wanted to allow Numbers access to my Contacts. Is it possible you tried this and dis-allowed it access?
    You might check, anyway. Open Security & Privacy System Prefs, select Privacy tab, and select Contacts from the list of items. Is Numbers listed and is it checked?
    Another way to get the contact information into the clipboard is to create an Automator workflow like this:
    Open Automator and select Workflow from the options presented.
    Drag in the above actions and set the properties as you like. For the Get Contact Information action, you must set the export format to Spreadsheet (tabs).
    For the new Text File action, I had to set the Encoding to Unicode (UTF-8) or it would fail.
    Select all the contacts you want and then click the Run button in Automator. You can then open the text file with Numbers.
    If you envision doing this often, start with an application instead of a Workflow and save it somewhere. Then, you can select your contacts and double-click the Application to export the contacts each time.
    The benefit of this method is that you can select all the fields you want to include (at least more than is provided in Drag and Drop).

  • Drag and drop issue between JLists

    Hi,
    I am trying to implement DnD into my application between different JLists, but I can't get it to work.
    In my application I have two different panels, a SearchPanel, and a DataPanel.
    On each panel I have two JLists, one which contains strings, another which contains a custom class called Goals.
    The lists on the searchpanels are the source of the drag action, each with their own DataFlavor. I wanted each of the two JLists on the datapanel to accept both flavors, so I implemented the DropTargetListener on the DataPanel. I figured I could determine where the drag came from depending the DataFlavor of the Transferable, but somehow, he treats the GoalTransferable as Strings, and adds them to the wrong list...
    Is there anyone that knows were I might have made a mistake?
    Here is some code:
    The search panel with relevant bits and pieces, th materialsList contains Strings, the goalsList contains Goal objects
    public class SearchPanel extends JPanel implements ActionListener, DragGestureListener, DragSourceListener {
       private JList materialsList;
       private JList goalsList;
       private void createGUI () {
          materialsList = new JList();
          materialsList.setDragEnabled(true);
          goalsList = new JList();
          goalsList.setDragEnabled(true);
          DragSource dragSource = DragSource.getDefaultDragSource();
          dragSource.createDefaultDragGestureRecognizer(goalsList,DnDConstants.ACTION_COPY, this);
       public void dragGestureRecognized(DragGestureEvent dge) {
          Goal selection = (Goal)goalsList.getSelectedValue();
          Transferable transferable = new GoalTransferable(selection);
          dge.startDrag(new Cursor(Cursor.MOVE_CURSOR), transferable);
       public void dragDropEnd(DragSourceDropEvent dsde) {}
       public void dragEnter(DragSourceDragEvent dsde) {}
       public void dragExit(DragSourceEvent dse) {}
       public void dragOver(DragSourceDragEvent dsde) {}
       public void dropActionChanged(DragSourceDragEvent dsde) {}
    }For the GoalTransferable class:
        public class GoalTransferable implements Transferable {
            private DataFlavor goalFlavor = null;
            private DataFlavor supportedFlavors[] = {goalFlavor};
            private Goal object;
            public GoalTransferable (Goal o) {
                object = o;
                try {
                    goalFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + ";class=nl.lycos.fierensyves.jsv.data.Goal");
                } catch (Exception e) {}
            public Object getTransferData(DataFlavor df)
                throws UnsupportedFlavorException {
                if (isDataFlavorSupported (df))
                    return object;
                else
                    throw new UnsupportedFlavorException(df);
            public boolean isDataFlavorSupported (DataFlavor df) {
                return (df.equals (goalFlavor));
            public DataFlavor[] getTransferDataFlavors () {
                return supportedFlavors;
        }And finally for the datapanel:
    public class DataPanel extends JPanel implements ActionListener, MouseListener, KeyListener, ChangeListener, DropTargetListener {
         private JList materials;
         private JList goals;
                    private DataFlavor goalFlavor = null;
         public ActivityFrame (DataReader data) {
              this.materials = new JList();
                                    DropTarget materialsTarget = new DropTarget(materials, this);
              this.goals = new JList();
              this.goals.addMouseListener(this);
                                    DropTarget goalsTarget = new DropTarget(goals, this);
                                    this.goals.setTransferHandler(new GoalTransferHandler(goals));
                                    try {
                                                    goalFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + ";class=nl.lycos.fierensyves.jsv.data.Goal");
                                    } catch (Exception e) {}
                                    public void drop (DropTargetDropEvent dtde) {
                                    if (dtde.isDataFlavorSupported(goalFlavor)) {
                                                     //import goal
                                    } else {
                                                     //import material
                                         TreeSetListModel model = (TreeSetListModel)this.materials.getModel();
                                                    String material = "";
                                                    try {
                                                                     material = dtde.getTransferable().getTransferData(DataFlavor.stringFlavor).toString();
                                                    } catch (Exception e) {}
                                         model.addElement(material);
                                         this.materials.setModel(model);
                                         this.materials.updateUI();
                    public void dragEnter(DropTargetDragEvent dtde) {}
                    public void dragExit(DropTargetEvent dte) {}
                    public void dragOver(DropTargetDragEvent dtde) {}
                    public void dropActionChanged(DropTargetDragEvent dtde) {}       
    }greetings,
    fifijr

    That does not exist - the workaround (maybe permanent solution - who knows) is
    File menu ==> export
    And BTW if you are not backingup all the time you are 100% guarenteed to lose all of your files and photos sooner or later
    LN

  • Drag and drop in newly shared folders not working

    Hello,
    Is can find some similar issues with GW8 Webaccess in the forum from some time back but not quite like what we are experiencing.
    We are unable to move message into newly shared folders for which we have all the rights. No problems with folders that were shared before (GW7) only with new created ones. No problems in the desktop client.
    What to do?

    mazzel,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://www.novell.com/support and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Forums Team
    http://forums.novell.com

  • Mail attachment drag and drop issue

    Been facing serious mail attachment drag-and-drop issue since 10.8 (if not from 10.7) and was disappointed to find the same behaviour still in 10.9.
    When I drag and drop a picture file (from Finder for example) into a message window or onto the Mail.app Dock icon, the system's window management somehow gets confused: my next step is to click on the message window in order to start typing. However, the mouse click causes that very window to escape under all other open applications / windows. Further on, I dig under to find the escapee and click again: once more it escapes. This can go on for a few annoying rounds until gets solved in an unexplainable way. This behaviour in not consistent, but has happens in about 8 cases out of 10.
    Apart from Mail.app I do not experience drag and drop issues of any kind.
    Anyone else suffering from this?

    I'd be interested in the answer to this too.
    It only just started happening to me a day or so ago, about the time that I think I did an OS upgrade.
    I'm on OSX 10.8.2.
    Its annoying.
    I can drop and drag in Finder but it just affects email.

  • Drag and Drop issue from Explorer folder to Music Library

    Hello
    I just updated my iTunes to 8.0.0.20 but something unexpected happened. I can’t drag and drop anymore songs from an explorer folder into my music library when my view mode is set to Grid (Album, Artist, Genre or Composer).
    When I try I have a kind of interdiction circle under my pointer.
    I can only perform this operation in list mode view. Few hours ago it was still possible to perform it but not after I updated. I reinstalled my iTunes but the problem persists.
    I have read the forums I know I can add to my playlist as usual by using the menu. But is it possible to get drag and drop operation when I drags song directly from a folder on my explorer window?
    It would be very appreciated if someone has an answer. I really messed up my library trying to fix this

    I fixed the drag and drop issues I had! Turns out they were caused by the permission problems of Vista. To fix it I just made sure all the files in the iTunes folder and sub folders were full control by my account.
    Make sure you check the properties of the iTunes database specifically because before, the iTunes folder had the correct permissions but they hadn't actually been inherited correctly by the iTunes DB files. Hope this helps anyone else.

  • Drag and drop issue alternatives

    Hello
    i'm having the same drag and drop issue as the other guys here. basically cant drag and drop to the desktop. Im looking for a workaround that doesnt involve making temporary backups or repairing iphoto libraries. My library is 260gb and even though it is being backed up i dont have a spare 260gb.

    That does not exist - the workaround (maybe permanent solution - who knows) is
    File menu ==> export
    And BTW if you are not backingup all the time you are 100% guarenteed to lose all of your files and photos sooner or later
    LN

  • Drag and drop to photo shop no longer works after installing Apple "Photos"; It was working fine before the latest Apple update (10.10.3) . what can be done?

    drag and drop to photo shop no longer works after installing Apple "Photos"; It was working fine before the latest Apple update (10.10.3) . what can be done?

    Nothing. It's nothing to do with PSE; this is a limitation of Photos, as is the loss of being able to use an external editor without exporting copies of your images.

  • Drag and drop issue, please help.

    I can no longer drag and drop photos within photoshop elements 12.  When working with a layer, I want to move it to a layer within another existing file, and no longer have the option.  The only way I have fixed the issue in the past is uninstall and reinstall the program.  I've read other forum posts and followed the instructions by resetting preferences and it does not work.
    Does anyone have any solutions to this issue?  Please help!

    With both files open, simplest to tile them side by side, you should be able to drag the layer from the source file onto the target file. So long as it shows the 'grasping hand' you can release the mouse and it should add the layer to the target.
    So what is happening now on your system? When you drag the layer to the target what icon is shown - 'grasping hand', 'no entry', something else?
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • Wacky Drag and Drop issue with JNLP

    I'm sure I'll have to be a bit more descriptive but I'll just throw this out and see if anyone has any suggestions.
    I've got a swing app which is an administration tool to a rules engine I have built. I distribute the app to users using JNLP 1.2.
    Here's the problem. When I launch the app using JNLP, a portion of the app does not work. There is a panel in which I allow users to drag items off of a tree and onto a panel. They can drag and drop one item but when they attempt to drag and drop a second item it doesn't drop. If I take that same code which is being distributed via JNLP, copy it to the local machine and run it, it works. I can drag and drop all day long.
    There are no exceptions, no errors or funny gooey state things going on. I start the drag, the mouse pointer changes, I hover of the drop zone and let go of the mouse and it appears to drop, but the component does not show. Wacky.
    Does this set off any bells to anyone?
    Thanks,
    - Jay
    App compiled using 1.4.1_01.

    Ah ha.. Yes this does seem to the issue. Thanks for the response. I've tested it on a couple of machines and it works on the one's with 1.4.1 and it doesn't seem to work on 1.4.0 jre machines.
    NEW Question though, if I set my .jnlp to:
    <j2se version="1.4.1+"/>
    I get the 'ol 'Error Code 11 (11 Could not locate requested version'
    Is there any way to get this guy to auto-install???
    I've installed JRE 1.4.1 manually and it doesn't seem to pick that up either.
    Thanks...

  • Preview Drag and Drop Issue

    I use preview in school a lot. Converting lectures to PDF is a lot easier to use and i us a program called iFlash to make flash cards.
    What I want to do is use the text tool to highlight sections of text, drag them to the flash card window and then drop the text there. This is a really quick and easy way to make the flash cards.
    This works except when i click back to the card all the text that i dragged is deleted.
    Does anyone else have this issue. I have checked, this feature (highlight and drag...) works well in other programs (mail, pages) but not with my flash card program.
    Any ideas?

    I have checked, this feature (highlight and drag...) works well in other programs (mail, pages) but not with my flash card program.
    That suggests that the problem is with iFlash. Will it accept drags from other programs, besides Preview? If not, it probably doesn't support drag and drop at all. If it does, then its implementation is probably buggy, and you should contact the developer.

  • About Drag and drop issue

    As title, i am a newbie to flash using ActionScript 2.0 , and currently i enounter the problem with drag and drop coding. Below is my code:
    function dragSetup(clip, targ, position) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    this.onTarget=true;
    gotoAndStop(position);
    } else {
    this.onTarget=false;
    gotoAndStop(position);
    clip.myHomeX=clip._x;
    clip.myHomeY=clip._y;
    clip.onEnterFrame = function() {
    if(this.onTarget)
              this._x-=(this._x-this.myHomeX)/5;
              this._y-=(this._y-this.myHomeY)/5;
    function dragSetup2(clip, targ, correct) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    clip._visible = false;
    this.onTarget=false;
    gotoAndStop(correct+1);
    } else {
    this.onTarget=false;
    gotoAndStop(correct);
    var frame:Number = 1;
    dragSetup2(flexibleTxt, questionBox, frame);
    dragSetup(transparentTxt, questionBox, frame);
    dragSetup(blueTxt, questionBox, frame);
    dragSetup(TIRTxt, questionBox, frame);
    dragSetup(TRTxt, questionBox, frame);
    dragSetup(ssmTxt, questionBox, frame);
    dragSetup(siliconTxt, questionBox, frame);
    dragSetup(silicaTxt, questionBox, frame);
    dragSetup(silicateTxt, questionBox, frame);
    dragSetup(infraTxt, questionBox, frame);
    dragSetup(radioTxt, questionBox, frame);
    dragSetup(lightTxt, questionBox, frame);
    dragSetup(copperTxt, questionBox, frame);
    dragSetup(gopTxt, questionBox, frame);
    dragSetup(liquidTxt, questionBox, frame);
    The scenario is , whenever correct mc was drag and drop on the target mc , it move to the next frame with new target mc(new question) , for example "questionBox2".
    By applying the code above, everything work fine but i would like that whenever i "throw" the answer mc (flexibleTxt, blueTxt etc) , i want it to slide or glide for little more distance, jz like how u throw a card in real life on a smooth surface.
    I also prefer that when draging it's "angle?" change according to the direction of draging. For example if u point ur finger on north side of a card and drag to the east, it's "angle?" will change according to the direction u drag, in this case, means east.
    I know my description seem abit complicated but i really someone can undestand and help me solve this issue.
    This is the link i reference to for the code above,but i modify it to my own preference :http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37 /
    PS : can i attach my fla file in this forum? if can, why i cant found any attach button?

    I am having a similar but reverse problem: Under 10.5.2, when trying to push or pull files from my wireless MacBook Pro via my Airport Extreme base station to or from my wired G5 Power PC, files hang in mid copy then stall.
    The other way around -- working from the G5 -- I have no problem at all.
    This started with 10.5, but I'm not sure if it was .1 or .2 because I upgraded from 10.4 just recently and did the combined 10.5 updates all at once on both machines.
    Thanks

  • File can not be moved by drag and drop in the finder when not open Finder windows

    With the operating system OSX Snow Leopard, it was possible, for example, a file from the desktop to pull drag and drop on the Finder icon, the page opened after a short and you could put the file in a folder.
    At this stage I must first open the Finder to drag a file into the destination folder.
    Is it a setting or is there anything wrong with my Mountain Lion properly?
    It is often the case that several windows of other applications are open or in Fullscreen are, then I would, as I also already knew and am accustomed, for example a file regardless of the location from which drag drag and drop in the Finder without leaving the / program / ​​site to open the Finder, before returning to the file then select I wanted to move.
    Note: For all other programs it works.
    Finder not only in where it makes the most sense.
       Picture 1: Finder window opens when you drag a file to the Finder icon
       Picture 2: Finder icon flashes but the Finder window does not open. Finder windows have previously by clicking on the icon in the Dock will be open to pull a      file into it.
       Thanks in advance for your help :-)

    Yes, all I can tell you is that Finder does not have that function in ML. Your system is "working as expected".
    You can file feedback here.

Maybe you are looking for

  • Error while adding two facts in One SA

    Hello Experts, I am new in OBIEE 11g. But with the concept of OBIEE 10g, I tried to work on 11g as well. Requirement: One subject area with two dimensions and two facts. In the warehouse we have 2 fact and 2 dimensions. Dim – Programme. Dim – Student

  • SAPSCRIPT Print Preview / Output Type Options?

    When in a PO, ME23N, I do a Print Preview. For one of our businesses it displays two output types for selection, ZSBL and ZSTK, for another business (consolidated in the same test system) it just displays output without any selection options. Where i

  • How to make a choice in a dropdown box render what appears in anothe dropdox box?

    I am currently creating a SP 2013 Site. I have 5 dropdown boxes, when the first one is clicked on (City) it then populates from a lookup table which city is choosen and then fills in the other dropdown boxes. How would I make that happen in SharePoin

  • Enabling "Delete a Database" option in DBCA

    Hi, I want to delete my database using DBCA, i know i can directly drop the database , since i have tried all options to enable the option of "+Delete a Database+" but guess need right process...i have also tried by stopping all oracle services ..but

  • Crashes during the save process

    Okay, so now that we've determined that I DO have the PrE 8.0.1 update/patch- I need to figure out why I am unable to save the video I've spent days working on. As I stated in the last discussion concerning the update, I am in possession of a fairly