Drop&Drag problem

Hi ,everyone:
I want to drag one jtree node to one jtable cell.The tree's node I added my own class: "TreeBranch".
DefaultMutableTreeNode node=new DefaultMutableTreeNode(TreeBranch);The proplem is when I drag a tree node ,I find the "TreeBranch" class in the "(DefaultMutableTreeNode) path.getLastPathComponent()" and the variable "transferable" before the process: "source.startDrag(dge,DragSource.DefaultCopyDrop,transferable,this);"in the TreeDragSource.java .But when in the TableDropTarget.java,I accept the Transferable object ,the TreeNode's userObject is null if the node is my own class TreeBranch .If the node 's userObject is a string ,that was retained.
The variable "transferable" is the TransferableTreeNode's object.The class TransferableTreeNode implements Transferable.And The class TransferableTreeNode is:
// TransferableTreeNode.java
// A Transferable TreePath to be used with Drag & Drop applications.
import java.io.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import javax.swing.tree.*;
import com.clousoft.xbrlview.config.*;
public class TransferableTreeNode implements Transferable {
  public static DataFlavor TREE_PATH_FLAVOR = new DataFlavor(TreePath.class,
                                 "Tree Path");
  DataFlavor flavors[] = { TREE_PATH_FLAVOR };
  TreePath path;
  public TransferableTreeNode(TreePath tp) {
    path = tp;
  public synchronized DataFlavor[] getTransferDataFlavors() {
    return flavors;
  public boolean isDataFlavorSupported(DataFlavor flavor) {
    return (flavor.getRepresentationClass() == TreePath.class);
  public synchronized Object getTransferData(DataFlavor flavor)
    throws UnsupportedFlavorException, IOException {
    if (isDataFlavorSupported(flavor)) {
      return (Object)path;
    } else {
      throw new UnsupportedFlavorException(flavor);
}Who can tell me how to retain my own class type in the tree path when drag and drop.
Thanks !

At a guess, I'd say your data flavour indicates a
serialisable Java object. Thus it will be serialising
your tree node class but your user object probably
isn't serialisable and so doesn't survive the
transit.
In fact, DefaultMutableTreeNode quietly ignores
non-serialisable user objects when serialising
itself.
You could make your user object serialisable but that
may lead to unnecessary copying of it. If you want to
maintain a reference to the user object in your tableCan you me tell me the details ,because I touch the
(rather than receiving a copy of it) you should
probably be using a JVM-local object data flavour
instead.
Hope this helps.Excuse me!
Can you tell me the details because I did not know how to do it using a JVM-local object dataflavour or make my user object serialisable .I am a tenderfoot. Thank you .

Similar Messages

  • [AIR] Drag Problem (parent & children can receive d&d and HTML Control)

    Hi,
    I have a problem regarding drag and drop in AIR. The d&d involving parent & children that can receive d&d event and the children can contain HTML control. You might want to copy and paste the code below to get a better idea.
    The objectives are:
    1. If you drag the green object and drop it in the black area, it should alert "Parent Drop"
    2. If you drag the green object and drop it in the magenta (purple) color, it should alert "Child Drop"
    3. If you drag the green object and drop it in the white (HTML control) color, it should alert "HTML Drop"
    The problems:
    1. drag green object to black area, to magenta area, and back again to black area. Drop it, the alert is not shown
    2. drag green object to the white area (HTML control). Drop it, the alert is not shown
    Many thanks.
    The Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
         <mx:VBox verticalGap="0" x="50" y="50" width="200" height="200" backgroundColor="#000000" horizontalAlign="center" dragEnter="onParentDragEnter(event)" dragDrop="onParentDrop(event)">
              <mx:Canvas id="canvas1" width="50" height="50" backgroundColor="#00ff00" mouseMove="onMouseMove(event)"/>
              <mx:HTML id="html" width="50" height="50" dragEnter="onHtmlDragEnter(event)" dragDrop="onHtmlDrop(event)"/>
              <mx:Canvas id="canvas2" width="60" height="50" backgroundColor="#ff00ff" dragEnter="onChildDragEnter(event)" dragDrop="onChildDrop(event)"/>
         </mx:VBox>
         <mx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.DragEvent;
                   import mx.managers.DragManager;
                   import mx.core.DragSource;
                   public function init():void
                        html.htmlText = '<div style="font-size:small">HTML Control</div>';
                   public function onMouseMove(event:MouseEvent):void
                        var dragInitiator:Canvas = event.currentTarget as Canvas;
                        var ds:DragSource = new DragSource();
                        ds.addData("item", "item");
                        DragManager.doDrag(dragInitiator, ds, event, dragInitiator);
                   public function onChildDragEnter(event:Event):void
                        trace("onChildDragEnter");
                        DragManager.acceptDragDrop(event.currentTarget as Canvas);
                   public function onParentDragEnter(event:Event):void
                        trace("onParentDragEnter");
                        DragManager.acceptDragDrop(event.currentTarget as VBox);
                   public function onChildDrop(event:DragEvent):void
                        trace("onchilddrop");
                        Alert.show("Child Drop");
                   public function onParentDrop(event:DragEvent):void
                        trace("onparentdrop");
                        Alert.show("Parent Drop");
                   public function onHtmlDragEnter(event:DragEvent):void
                        DragManager.acceptDragDrop(event.currentTarget as HTML);
                   public function onHtmlDrop(event:DragEvent):void
                        Alert.show("HTML Drop");
              ]]>
         </mx:Script>
    </mx:WindowedApplication>

    The parent drop issue is because there can only be one drag acceptor and you don't get another dragEnter event when the mouse leaves the child (since technically, it never left the parent). This isn't as big an issue as it might seem, since generally you wouldn't have both a parent and a child that could take the drop. The ways to fix this are to use the dragOver event in addition to dragEnter or you could handle the dragExit event dispatched by the child and set the drag acceptor back to the parent.
    The HTML control issue is a bit trickier. HTML content has its own drag-and-drop system that operates a bit differently than the ActionScript version. I don't think there is a way to intercept the events before they are handled by the WebKit HTML engine. You can accept a drop in HTML/JavaScript code as described here: http://help.adobe.com/en_US/as3/dev/WS6717AA0A-2B7D-4728-86DC-7D60F919E6B4.html.

  • AirTunes with AirportExpress cut or drop out problems - my solution...

    I buyed 2 of the Airport Extreme one month ago (Firmware 6.3, Itunes 7.1.1), never got them working fine, till yesterday...
    I have A Zyxel ADSL WLAN Router Switch. WPA-PSK as I wanted a secure Network. Both of the AX were connected with static IPs. WLAN was always working fine, but I had many cut outs with airtunes. I wanted a solution with lossles streaming audio with the possibility to connect my Receiver digitally. That's why I bought my first Apple hardware, as I was always told, Apple=Plug'n play. Very frustrating!
    I tried other switches, Routers, WLAN adapters and cards, nothing worked. Airfoil does not support multiple speakers yet, so it's useless for me.
    In the FAQ of the Airtunes, Apple mentioned to use lower security, as some Computers probably do not have enough power to stream music flawlessly. But my Computers really do have enough power! I think the AX does not have enough power to do that. So I created another wireless network with one of my AX. I set the security to WEP-40bit key and joined this new Network with my other AX. Not the best solution, as I'm now connected to the Internet or to the AX to use Airtunes. Cables could fix that problem, but then I could use a wired system instead...
    I use Channel 11 for the AX WLAN (the only clean channel in my area), Multicast to 11, only G mode for Wireless and a 5 characters WEP-40 key and no WDS. Seems to work at the moment.
    I hope this will help others with the cut or drop out problem. If you have a working AirTunes system, please post your setup. Mostly I'm interested in a Setup with working WPA...

    Thanks, I hope I can help others with this annoying problem...
    Sorry, I forgot to write about the RF Interference. Belive me, I spent hours and hours searching for a solution in the Internet and every checkbox the Admin utility offered me to try out... I'm working as a system engineer, and supporting computer systems since the early 90ties, so I'd say I have a bit knowledge about all the networking, WLAN, Audio... In school we had the Apple Mac I with the 12" monochrome monitor and appletalk for networking quite funny!
    But back to the RF interference: At the moment I activated it on both AX I own. I have a microwave, wireless phone and I'm living in a Area with many WLAN access points. I can choose between 6 networks!
    I'm the only one with a network higher than channel 6, so this area is clean at least.
    As my AirTunes do work at the moment, I'm not going to try if I could also deactivate it.
    Next step is to try if I can connect the AX Router to the internet. A connection to my ADSL router should do that, but up to now I had very strange behavior when plugging in a ethernet cable to the AX. If this will work, it will be my final solution, at the moment I only see it as a workaround...

  • Photoshop CC2014 and Windows 8 - click "drag" problem

    Hey there!
    So, I have recently started using the latest version of Photoshop CC2014 under windows 8.1 and I'm having this weird problem.
    I'm using a Cintiq 24HD touch with latest drivers, and touch disabled. I have also disable any kind of click and hold windows has - for tablets and for touch input.
    Cursor Drag problem in Photoshop CC2014 - YouTube
    Still, when I try to make fine adjustments on sliders, I click and the slider simply does not move. This does not happen every click, but it happens often enough to be annoying as hell. It is happening everywhere, from panels to liquify window, to using the hand tool to navigate the image, and not only in sliders! Trying to make fine adjustments in liquify with your brushstroke jumping around is not fun.
    I'm not sure what and where the problem is, but this simply does not happen in any other application (Photoshop CC; Sketchbook Pro, Paintstorm Studio, Krita).
    Does anyone have any idea?
    Thanks in advance,

    I have been using Photoshop on windows for more then 20 years on windows. Windows 95, Windows 2000, Windows XP and Windows 7.  I never installed Windows ME, Windows Vista or Windows 8.  I have never seen any version of Photoshop change a displays brightness or even the image color when scaling or going from  float to tab to single image with PS UI to full screen.  However I hardly ever use Photoshop in full screen mode.
    At different zoom views image may seem like the color change because of the scale of the image or the portion of the image that is on screen or the color of the border around the image.

  • .JPGs used in the drop/drag quiz questions

    In Captivate 4, can .JPGs be used in drop/drag quiz questions? We need to see if Learners can properly "build up" a sub-assembly of a machine and they will need to know which part fits on top of the correct piece of equipment.
    If not, any suggestions?

    No.  Currently no version of Captivate allows you to set up drag and drop interactions natively with images as the drag objects or targets.
    However, there are two widgets that can be purchased to do this:
    http://www.infosemantics.com.au/adobe-captivate-widgets/drag-and-drop/which-adobe-drag-and -drag-and-drop-widget-comparison
    Free trial versions of the widgets can be downloaded here if you want to try them out:
    http://www.infosemantics.com.au/adobe-captivate-widgets/download-free-trial-widgets

  • Sudden Dropped Frames Problem with 720p24 material

    After sailing along for months with perfect operation from Final Cut Pro, editing 720p24 (I'm still running 5.0.4), I have encountered a mysterious hangup that I can't seem to solve. It probably began shortly after I was doing a test on a new project and mistakenly used a 44khz sound file rather than a 48khz. That project ran fine for a couple of days as I played with it, then abruptly began to drop frames at very particular points. I trashed the sound file and reimported it as a 48khz file and that seemed to fix things for a day or two. Then, to my utter horror, when I opened a very large ongoing project that I needed to tweak, I found that the dropped file problem has corrupted my entire FCP operation. I have tried changing various settings, such as unlimited RT, and trashed the preferences as well, but none of the straightforward cures seems to make a difference. I've also looked at all the suggestions in the Apple dropped frames article at [docs.info.apple.com]. I have never had a problem with dropped frames prior to this.
    My scratch disk is a raided SATA drive with plenty of space to spare. This setup has worked flawlessly since July. I have jumped around over the past 10 days from work on old SD projects to 720p24 projects and have been changing settings here and there to accomodate this. Nothing else seems to have been changed that may account for the glitch.
    I have not reinstalled the software.
    Anything that comes to mind as a logical next step would be most appreciated!

    Yes during panning or zooming I can see that frames are dropping in the stats panel.
    I'm encoding at 500kbps video + 48 audio, outputting only one stream.
    The content in the input monitor shows exactly what the cam is seeing, with the pan and/or zoom correctly displayed. On the output monitor side the action will freeze momentarily when frames are dropped. Then the display will skip to the point where no more frames are being dropped.
    The native frame rate for the cam is 29.97, but as an output, averaging in the dropped frames the rate may drop as low as 27 or 28fps according to the stats panel. The difference being the number of dropped frames.
    FMLE is installed on a Dell Studio 15 with 4 GB RAM, which I would think would be plenty adequete.
    Thanks for your response.
    Adninjastrator

  • Drop Float Problem

    Can someone help me with a drop float problem I am having in
    the old version of internet explorer? Please see this website:
    http://003a17b.netsolhost.com/kwdwebsite/index.html
    The green navigation bar should be lined up with the green
    bar in the logo (at the top). IE 6.0 is dropping it down lower. Can
    anyone help resolve this issue? Thanks!

    [email protected] posted in macromedia.dreamweaver
    > Can someone help me with a drop float problem I am
    having in the
    > old version of internet explorer? Please see this
    website:
    >
    http://003a17b.netsolhost.com/kwdwebsite/index.html
    > The green navigation bar should be lined up with the
    green bar in
    > the logo (at
    > the top). IE 6.0 is dropping it down lower. Can anyone
    help
    > resolve this issue? Thanks!
    (My IE6 box finally went to pasture, so I'll look into
    installing
    multiple IEs on one of my boxes this week)
    I would concentrate on creating valid code before trying to
    deal with
    cross-browser compatibility. You'll often find that that is
    all it
    takes.
    Enter your URL here:
    http://validator.w3.org
    For instance, you have several redundant, illegal instances
    of
    <link href="css/KWD.css" rel="stylesheet"
    type="text/css">
    inside the body element.
    It looks as if that might be part of a library item? If so,
    take it
    out.
    Reply back if that doesn't do it for you.
    Sidenote:
    Your excessive use of META keywords may be considered Meta
    tag stuffing
    or spamdexing and may not be as useful as you hope. Likewise
    for the
    double META Description where the second seems excessive. No
    links to
    back it up at the moment, but you might want to look into it.
    Mark A. Boyd
    Keep-On-Learnin' :)

  • AIR application object - mouse drag problem

    Hi,
    We face the following problem. Attached herewith are code sample and simulation for the problem. Would be great if someone could help us.
    Problem: Objects created in AIR application experience mouse drag problem.
    To simulate the problem please execute the  sample application, a grey box (object) appears on the screen. Hold down left and right mouse buttons and drag the object and release both the mouse buttons. Object sticks to mouse pointer and moves along with mouse pointer to wherever it is dragged.
    Steps to Reproduce  - Hold down left and right mouse buttons and drag the object and later release both the mouse buttons. Notice Object sticks to mouse pointer and moves along with mouse pointer to wherever it is dragged. Object stops to move along with mouse pointer after sometime, then move the mouse pointer to the object and see that it sticks to pointer again and gets dragged along with the pointer.
    Actual Result - Object sticks to mouse pointer and moves along with mouse pointer to wherever it is dragged.
    Expected Result - Object should not stick to mouse pointer even after the mouse buttons are released.
    Due to problems with uploading the attachment here, please send a email to the following email-id ([email protected]) and I shall send the attachment in response.
    Thanks in advance.

    After some research, it seems this problem has been there for years with Bootcamp.  Hope Apple can develop a better touchpad driver soon.

  • Why can't i drop/drag a playlist to my iphone icon in itunes?

    Why can't I drop/drag a playlist to my iPhone icon in iTunes?  If I try to manually sync, it says my phone is synced to another library and will be erased/synced with the library on my computer, which I don't want to do.  There are some songs on my current computer that would be deleted.  Do I have to completely try to rebuild the playlist?  I thought when I removed it from my phone last year, but saved it to my computer, I would just be able to drop/drag it to add it back on this year.

    You do it all the time with what from your MBP?
    You have manually manage music and video selected under the Summary tab for your iPhone sync preferences with iTunes?

  • I want to copy my iTunes library onto my iPhone without iCloud. Is this possible? In past you could drop & drag upon syncing....now only download via iCloud?

    i want to copy my iTunes library onto my iPhone without iCloud. Is this possible? In past you could drop & drag upon syncing....now only download via iCloud?

    So what is stopping you?
    Do you have manually manage video and music set up?

  • Upgraded to Adabe 10.1x reader and drag and drop text problems

    I cannot drag and drop text from my saved PDF files to word files or for example, into online forms since upgrading to Adobe new reader version today. How can this problem be resolved?

    So after a month of trying to figure all this out I FINALLY fixed the problem!
    Before you do anything just go to your destop > right click personalize (this is for windows 7 - might be different for XP; I honestly forgot, but same idea) > find "window color" > select "advance appearance settings
    (I think can be found by just typing "window color and appearance" in the search from the start menu).
    Finally select "active title bar" (If the font is SEGOE UI, then following the link is the best thing to do; IF ITS NOT, I would think you can just follow the same steps and modify accordingly to how you want your fonts to look in iTunes). http://answers.microsoft.com/en-us/windows/forum/windows_7-desktop/how-to-change -system-default-font-in-all-parts/dfce15db-7337-420a-a42e-517521a8502e
    Hopefully this helps!!! Worked for me!

  • Drag and drop image problems, Keynote

    I have used keynote for years, however, all of a sudden, I  (and other keynote users at my school) can no longer directly drag image files from the Finder into the the Keynote navigator side bar. Any help please? We are all running Mountain Lion.

    Some versions of Keynote are creating  problems with Mountain Lion.
    A work around that is helping most users:
    Delete iWork completly, you will need an uninstaller to do this properly, I use Appcleaner or purchase Appzapper to do this.
    If you have an iWork DVD disc, reinstall iWork and dont update, turn off auto updates.
    If this was an app store purchase log into the store and install iWork 9.3 http://support.apple.com/kb/HT5534
    Post back to let others know your experience

  • Magic Mouse single click double clicks and drops dragged images

    Last few weeks my Magic Mouse has started behaving strangely. When selecting something with a single click the mouse seems to double click and open the item instead of just selecting it. Very frustrating. When dragging anything across the screen it always drops the item halfway there.
    What is going on? Software? Hardware? I have no 3rd party software installed and have tried various double click speeds with the same result.
    Anyone have any ideas? Thanks.

    A lot of people have encountered this, Tom, myself included (see discussion here for instance: http://discussions.apple.com/thread.jspa?messageID=11547453&#11547453).
    It appears to be a bug in the OS. Annoying, but until Apple fix the problem, it's something we're unfortunately going to have to live with. Sorry I can't help you further.

  • Drag and Drop - Drag Image

    I'm using the Flex DragManager in an AdvancedDataGrid with
    HierarchicalData to allow the user to drag and drop tree nodes to
    re-order them. It is working fine. The problem I am having is with
    the drag image. The drag image does not always show up. It seems
    like it will appear for one drag and drop. Then if I try to drag
    another tree node I do not get the drag image there is just a line
    to show I'm dragging something.
    When I say drag image I mean the faded image of the text of
    the tree node which appears as I drag the tree node.
    I am using the following properties on the AdvancedDataGrid
    to enable drag and drop:
    dragEnabled="true" dropEnabled="true" dragMoveEnabled="true"
    Now if set dragMoveEnabled="false" then I do get a drag image
    everytime. But I need move the tree nodes around not copy them so I
    need dragMoveEnabled="true".
    Thank you

    I'm using the Flex DragManager in an AdvancedDataGrid with
    HierarchicalData to allow the user to drag and drop tree nodes to
    re-order them. It is working fine. The problem I am having is with
    the drag image. The drag image does not always show up. It seems
    like it will appear for one drag and drop. Then if I try to drag
    another tree node I do not get the drag image there is just a line
    to show I'm dragging something.
    When I say drag image I mean the faded image of the text of
    the tree node which appears as I drag the tree node.
    I am using the following properties on the AdvancedDataGrid
    to enable drag and drop:
    dragEnabled="true" dropEnabled="true" dragMoveEnabled="true"
    Now if set dragMoveEnabled="false" then I do get a drag image
    everytime. But I need move the tree nodes around not copy them so I
    need dragMoveEnabled="true".
    Thank you

  • Dropping dragged object to specic location of Tile Container

    Hi All,
    I am facing a problem in drag and drop application. Tehe problem is that when i am dragging the HBox to Tile container it always adding at last or first position but i want to add to specfic location based on existing children of Tile Container i..e when i am dragging the hbox on Tile container i want on which children of Tile container my mouse pointer so that i can get the position of that child and before or after of that particular child.Please use below image for refrence.
    In this example if i am dragging the desig field from field objects list and drop it in between the empno and firstname child on result object tile is is getting added at last in tile container. i am unble to get on which children of tile container the desig fiel drop.
    Thanks in advance.

    Hi All,
    I am facing a problem in drag and drop application. Tehe problem is that when i am dragging the HBox to Tile container it always adding at last or first position but i want to add to specfic location based on existing children of Tile Container i..e when i am dragging the hbox on Tile container i want on which children of Tile container my mouse pointer so that i can get the position of that child and before or after of that particular child.Please use below image for refrence.
    In this example if i am dragging the desig field from field objects list and drop it in between the empno and firstname child on result object tile is is getting added at last in tile container. i am unble to get on which children of tile container the desig fiel drop.
    Thanks in advance.

Maybe you are looking for