drag-and-drop

Drag and Drop nodes in JTree

久未见 提交于 2019-12-17 17:44:08
问题 I am having difficulty creating a JTree that allows the nodes to be reorganized by dragging and dropping them in the JTree. This seems like it should be relatively simple. I have looked at examples online, but I can not seem to implement it in my own code. For example, this provided by sun allows for dragging between different components into the tree, but not from within the tree itself. And I have also found this that allows you to drag text into the JTree, but not within the tree. import

Drag and Drop with NSStatusItem

我与影子孤独终老i 提交于 2019-12-17 17:33:19
问题 I'm trying to write an application that allows the user to drag files from the Finder and drop them onto an NSStatusItem . So far, I've created a custom view that implements the drag and drop interface. When I add this view as a subview of an NSWindow it all works correctly -- the mouse cursor gives appropriate feedback, and when dropped my code gets executed. However, when I use the same view as an NSStatusItem's view it doesn't behave correctly. The mouse cursor gives appropriate feedback

jQuery Sortable with animation

删除回忆录丶 提交于 2019-12-17 17:32:15
问题 I'm using jQuery and Sortable to arrange my list of items (and this http://dragsort.codeplex.com). All works perfect. I'm using a function on dragEnd to arrange the lists in order. Here is my code: $("#list1, #list2").dragsort({ dragSelector: "div", dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "<li class='placeHolder'><div></div></li>" }); function saveOrder() { var data = $("#list1 li").map(function() { return $(this).children().html(); }).get(); $("input[name=list1SortOrder]"

java.util.ConcurrentModificationException in View.setVisibility

感情迁移 提交于 2019-12-17 15:44:45
问题 I'm implementing drag'n'drop for views. When drag is started, I set visibility of the view to INVISIBLE , then, if the drag was interrupted - back to VISIBLE : public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { // Skipped some code boolean dragStarted = v.startDrag(data, shadowBuilder, v, 0); if (dragStarted) { v.setVisibility(View.INVISIBLE) } } } And: if (event.getAction() == DragEvent.ACTION_DRAG_ENDED) { View droppedView = (View) event

HTML5 drag and drop to move a div anywhere on the screen?

二次信任 提交于 2019-12-17 15:28:53
问题 The title is pretty self explanatory. All the demos I've found consist in dropping a div to a certain location. E.G a trashcan. I need to make a draggable div that can be dropped anywhere on the screen. Is it possible to do this with HTML5? if not how should I do it? 回答1: It's quite straightforward really: In the dragstart event calculate the offset between where the user clicked on the draggable element and the top left corner Make sure the dragover event is applied to the entire document so

How to detect the dragleave event in Firefox when dragging outside the window

守給你的承諾、 提交于 2019-12-17 15:17:58
问题 Firefox doesn't properly trigger the dragleave event when dragging outside of the window: https://bugzilla.mozilla.org/show_bug.cgi?id=665704 https://bugzilla.mozilla.org/show_bug.cgi?id=656164 I'm trying to develop a workaround for this (which I know is possible because Gmail is doing it), but the only thing I can come up with seems really hackish. One way of knowing when dragging outside the window has occurred it to wait for the dragover event to stop firing (because dragover fires

Drag and Drop icons to Home Screen

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 14:44:57
问题 Update: to understand my question, here is what i need to achieve: Drag icon from App drawer to home screen ( if possible not in a gridview) like in the pic, Old (this just to learn how this works): I'm trying to implement dragging clickable icons from a ListView to a customView with no container( Listview or Gridview... ) inside the same Activity or another, here is a picture for you to understand more: but when i put the icon in the right area i don't see the object , in the log i see: I

html5 drag and drop FOR MOBILE [duplicate]

两盒软妹~` 提交于 2019-12-17 12:34:06
问题 This question already has answers here : HTML Drag And Drop On Mobile Devices (8 answers) Closed 5 years ago . I found this code on w3schools for drag and drop, which works on a desktop, but not mobile devices. What do I need to modify so that it recognizes touch? <!DOCTYPE HTML> <html> <head> <style type="text/css"> #div1 {width:350px;height:70px;padding:10px;border:1px solid #aaaaaa;} </style> <script> function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer

Drop event not firing in chrome

蓝咒 提交于 2019-12-17 10:38:33
问题 It seems the drop event is not triggering when I would expect. I assume that the drop event fires when an element that is being dragged is releases above the target element, but this doesn't seem to the the case. What am I misunderstanding? http://jsfiddle.net/LntTL/ $('.drop').on('drop dragdrop',function(){ alert('dropped'); }); $('.drop').on('dragenter',function(){ $(this).html('drop now').css('background','blue'); }) $('.drop').on('dragleave',function(){ $(this).html('drop here').css(

HTML5: dragover(), drop(): how get current x,y coordinates?

家住魔仙堡 提交于 2019-12-17 09:37:34
问题 How does one determine the (x,y) coordinates while dragging "dragover" and after the drop ("drop") in HTML5 DnD? I found a webpage that describes x,y for dragover (look at e.offsetX and e.layerX to see if set for various browsers but for the life of me they ARE NOT set). What do you use for the drop(e) function to find out WHERE in the current drop target it was actually dropped? I'm writing an online circuit design app and my drop target is large. Do I need to drop down to mouse-level to