Handling drag/drop JFrame Event

Hello,
I would like to handle the drag event which happens when I press right button of my mouse in my JFrame`s title and then I drag the JFrame till I release the button of my mouse. I found a lot of interfaces to handle the event like MouseMotionlistener or DragSourceMotionListener, but none of them work fine. I have checked that all these listeners handle the movement in the JFrame (inside JFrame's borders) but I need to handle the happened event when I click on my JFrame's title and move the JFrame in the screen. Does anyone know how I could solve this problem?
Thank you in advance

Hi,
Firstly, thank you for your answer.
I tried to use what you wrote in the link but the problem is that it is a class, and my class Extends from JFrame so it cannot extend from another one. Do you have an example where it is explained how I could use it? I am newbye in this and I do not exactly understand how I can use it.
Thank you again

Similar Messages

  • How does JDeveloper handle drag & Drop?

    Using JDeveloper I want to implement sticky widgets in my web application. These widgets can be like buttons and can be contained in the browser in a free-form way so that users can pick and choose these widgets and drop in the work area(a form area or blank area.
    I know it can be done using Swing and it's just a Java code. But, can someone please send me some code examples or explain to me how this can be done with examples?
    TIA,
    Mark

    I'm just starting to explore drag and drop. Here's some references I've found that you may find helpful?
    http://www.rockhoppertech.com/java-drag-and-drop-faq.html
    http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html
    http://java.about.com/compute/java/library/weekly/aa011299.htm
    Hope this helps.
    null

  • How to drag drop a calendar item to a time in next week ?

    Hi
    creating a event through a big menu is fine ... but a very elegant and quick way is to select the cells and write the event. similarly, drag-drop a event is super easy way to re-schedule an event to another time. when i have 20-30 events to re-schedule from current to next week, drag-drop is best.
    however, i am unable to do that. when i drag drop, i cant drop it to next week (i am using weekly view to be able to select any time of destination day for drop - the bi-weekly or monthly views don't allow choice of destination time)
    this could be implemented in two ways :
    1. in current weekly view, if the drag crosses the boundary, calendar shifts to the next (or previous) week. and then i drop the event.
    2. there can be a option to see upto 2 weeks in columns just like 1 week view. i understand that the columns will be too tight but the fullscreen option makes it very usable.
    or, you can suggest your own work-around.

    instead of using target, try using currentTarget...
    event.currentTarget.startDrag();
    event.currentTarget.stopDrag();

  • Drag Drop Event

    Hello All,
    Can I trap the Drag and Drop event of a file from desktop through Scripting for Adobe Bridge.
    Thank you all in advance.
    Regards
    Farzana.

    I haven't seen such an event available to the scripts. I have an event handler and when I turned on my own logging to output all the events that I see, I didn't see any drag/drop events when I tried that operation. That doesn't mean there isn't someother way to do this, but it wasn't obvious to me through normal event handling.
    --John

  • Drag & Drop kills Tree Change event

    I have a tree that I am dragging from to a HorizontalList.
    Anyway, I have the actual drag and drop working fine. However, my
    tree has a handler for it's change event so that when the selected
    item changes, a web service lookup is initiated. After the drag and
    drop the tree appears to have a different item selected, however
    the change event does not fire. Also if I manually click on the
    same row that already appears selected, the event fires and my
    lookup is kicked off.
    It's like after the drag drop the tree's selected item
    appears selected VISUALLY but the tree does not know it is the
    selected item.
    HELP PLEASE.
    P.S. - I am using Flex 2.01 by the way.

    The trick is not to use the tree drag* properties of the
    control and instead use the DragManager to do custom drag and drop.
    This allows to listen to mouse down events and evaluate
    whether to useDragManager.doDrag() to initiate a drag.

  • How to handle the drop event

    Hi everyone,
    Now I'm developing the function about drag-drop source(image & text) from Panel Tree to the document.
    I also have a look at the basic drag/drop & Panel Treeview, but all of them is not the source code mentions to how to handle the drop event, almost about drag event only.
    Now when user Drags(image, text) from PanelTreeView(example) and drops them to document and then new page Item contains source(image, text) created, so I want to get the page item after drop event.
    so anyone know about this please give me suggestion
    thanks so much.

    i dont think you can.
    ~~~~~~~~~~~~~~~~
    --> Adobe Certified Expert
    --> www.mudbubble.com
    --> www.keyframer.com
    ~~~~~~~~~~~~~~~~
    keyoke_za wrote:
    > Hi,
    > How can I get my flash movie to handle the drop event
    when dropping objects from outside the flash window.
    > Thanks for your help..

  • Simple drag&drop with handler doesn't work in Edge?

    Hi all!
    I made this very simple example of Drag&Drop in Edge: http://www.terredainventare.it/simpledrag/simpledrag.html using Jquery Ui http://docs.jquery.com/UI/Draggable.
    I try to use the JQueryUi "handle" property that makes you drag an object restricting drag click on only one element but it doesn't work.
    Here's the code I've put in Edge onCompositionReady:
    sym.$("drag").draggable({ handle:"handler" });
    Of course my two Div-elements are called "drag" and "handler". Now the drag works only on the "wrong" element and not on the "handle".....
    Here's the Adobe Edge files: http://www.terredainventare.it/simpledrag/web.zip
    Many thanks in advance for your help!
    Davide

    So, on stage i add a rectangle named "drag" and i try this code:
    yepnope({
                nope:[
                'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js',
                'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css'
                complete: init
    function init() {
             //$("#Stage_drag").draggable();
             //$(sym.lookupSelector("drag")).draggable();
             sym.$("drag").draggable();
    3 lines work: $("#Stage_drag").draggable() or $(sym.lookupSelector("drag")).draggable() or sym.$("drag").draggable()
    And css file is not required.
    Well, your dowload link is not perfect but i download your folder. See you later.
    There is a tutorial: a movie tutorial (adobe tv). Mix it baby! Extending Edge Animate 02:57
    They use: yepnope (both, callback)
    yepnope({
         both: ['jquery-ui.min.js',
                   'jquery-ui.css'
         callback: function(){sym.$("drag").draggable()}
    I will send you your files tomorrow (private message).

  • Triggering pop-up event through drag & drop?

    Hi everyone, I'm a newly registered member of this forum.
    I've roughly browsed though this forum to seek a solution for my problem, but I can't seem to find a suitable solution (perhaps i should continue looking).
    Scenario:
    Anyway, I'm facing some technical challenges in flex as I'm relatively new to it.
    I'm trying to create a web application, where users use drag & drop to input information.
    I visualize this process:
    User selects icon from a list
    User drags the icon onto target area
    User releases icon over target area
    Pop-up appears with a form for users to input information.
    Users input information and submits
    Information is stored in the database.
    Present knowledge:
    Because I'm new to Flex, I tried to break this down and learn by components:
    I'm able to:
    Create a drag & drop effect
    Create connection to database using HttpService
    Main Problem:
    I'm able to use the drag and drop functionality but I cannot trigger a pop-up event when the icon is dropped onto the target area.
    Sorry if the problem seems a little insignificant due to my lack in knowledge.
    I'm just a student trying to learn. Hope that someone can help me out here, or provide me with relevant links to learning resources.
    Thanks in advance,
    Jord

    Hi,
    thanks so much for replying, but I would really appreciate a little bit more help.
    I vaguely understand the concepts of DragEvent.DRAG_DROP, but I'm not really familiar with the syntax of how to cause allow a pop-up to appear.
    This is how my script look like:
    <mx:Script>
            <![CDATA[
                import mx.events.DragEvent;
                import mx.containers.Box;
                import mx.managers.DragManager;
                import mx.core.DragSource;
                import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;
                [Embed("IconAssets/1.gif")]
                [Bindable]
                public var personalAsset:Class;
                [Embed("IconAssets/2.gif")]
                [Bindable]
                public var investment:Class;
                [Bindable]
                private var iconValue:uint;          
                private function iconDrag (event:MouseEvent, value:uint):void
                        var dragInitiator:Image = event.currentTarget as Image;
                        var dragSource:DragSource = new DragSource();
                        dragSource.addData(value, 'value');
                        var dragProxy:Image = new Image();
                        dragProxy.source = event.currentTarget.source;
                        DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
                private function dragOver(event:DragEvent):void
                        var dropTarget:Box=event.currentTarget as Box;
                        if (event.dragSource.hasFormat('value'))
                                dropTarget.setStyle("borderThickness", 5);
                                DragManager.acceptDragDrop(dropTarget);
                private function dragAway(event:DragEvent):void
                        var dropTarget:Box=event.currentTarget as Box;
                        revertTarget();             
                private function dragAccept(event:DragEvent):void
                        var value:uint = event.dragSource.dataForFormat('value') as uint;
                        The trigger for the Pop-up should be placed here.
                        revertTarget();
                private function revertTarget():void
                    fStatement.setStyle("borderThickness", 1);
            ]]>
        </mx:Script>
    I'm not sure whether I'm correct to state (in bold, italic, & underline) above that the event trigger for the pop-up should be within that particular function.
    The difficulty I'm facing now is that the (structure of the) popup should be written in MXML and yet I have to place them in the ActionScript.
    (I sense that I have a fundamental misconception of how this works,so please correct me to the best of your knowledge.)
    I would greatly appreciate it if anyone is able to provide me with an example/sample of how this should be done.
    With Thanks,
    Jord

  • Is there a Drag-Drop handler for TextAreas ?

    Is there a Drag-drop handler for TextAreas where new x,y positions can be saved as well ? Thanks in advannce

    Bernd, thanks for the helpful suggestion - I may be able to change my procedure and use that feature.  It would save me thousands of mouse clicks if I just found and dragged each .doc into the target folder, then used an Action to convert them all to PDF.  I still like the 'smart' folder idea, though....it would be a cool utility.

  • Issue with Drag/Drop of multiple rows from ListView

    I am working on a sample application with 2 list views i.e. players and team, and implement drop and drop such that players can be dropped from one list view to the other. Everything is working as expected when there is single selection model is enabled on the source list view. However, if I enabled Multiple selection model and drag 2 or more rows from source list view to target list view, seeing the following exception after the drop is completed.
    Exception:
    java.lang.IllegalArgumentException: Only serializable objects or ByteBuffer can be used as data with data format [subListPlayers]
      at com.sun.javafx.tk.quantum.QuantumClipboard.putContent(QuantumClipboard.java:513)
      at javafx.scene.input.Clipboard.setContent(Clipboard.java:230)
    1) What should be the DataFormat used in order to be able to drag and drop multiple rows? Looks like we do not have for Object type, so I have created the following one which does not solve the problem.
       private DataFormat dataFormat = new DataFormat("subListPlayers");
    2) I have made changes to support serialization on the data object which also does not seem to solve the issue. Tried by implementing Serializable interface as well as by implementing Externalize interface.
    Can someone please guide if there is an easy way to implement this behavior?
    Code:
    public class Player
       private String name;
       public Player(String name)
          this.name = name;
       public String getName()
          return name;
       public void setName(String name)
          this.name = name;
       @Override
       public boolean equals(Object o)
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          Player player = (Player) o;
          if (name != null ? !name.equals(player.name) : player.name != null) return false;
          return true;
       @Override
       public int hashCode()
          return name != null ? name.hashCode() : 0;
    public class JavaFXDnDApplication extends Application
       private static final ListView<Player> playersListView = new ListView<Player>();
       private static final ObservableList<Player> playersList = FXCollections.observableArrayList();
       private static final ListView<Player> teamListView = new ListView<Player>();
       private static final GridPane rootPane = new GridPane();
       private DataFormat dataFormat = new DataFormat("subListPlayers");
       public static void main(String[] args)
          launch(args);
       @Override
       public void start(Stage primaryStage)
          primaryStage.setTitle("Drag and Drop Application");
          initializeComponents();
          initializeListeners();
          buildGUI();
          populateData();
          primaryStage.setScene(new Scene(rootPane, 400, 325));
          primaryStage.show();
       private void initializeListeners()
          playersListView.setOnDragDetected(new EventHandler<MouseEvent>()
             @Override
             public void handle(MouseEvent event)
                System.out.println("setOnDragDetected");
                Dragboard dragBoard = playersListView.startDragAndDrop(TransferMode.MOVE);
                ClipboardContent content = new ClipboardContent();
    //            content.putString(playersListView.getSelectionModel().getSelectedItem().getName());
                content.put(dataFormat, playersListView.getSelectionModel().getSelectedItems());
                dragBoard.setContent(content);
          teamListView.setOnDragOver(new EventHandler<DragEvent>()
             @Override
             public void handle(DragEvent dragEvent)
                dragEvent.acceptTransferModes(TransferMode.MOVE);
          teamListView.setOnDragDropped(new EventHandler<DragEvent>()
             @Override
             public void handle(DragEvent dragEvent)
    //            String player = dragEvent.getDragboard().getString();
    //            ObservableList<Player> player = (ObservableList<Player>) dragEvent.getDragboard().getContent(dataFormat);
                String player = dragEvent.getDragboard().getString();
                teamListView.getItems().addAll(new Player(player));
                playersList.remove(new Player(player));
                dragEvent.setDropCompleted(true);
       private void buildGUI()
    //      rootPane.setGridLinesVisible(true);
          rootPane.setPadding(new Insets(10));
          rootPane.setPrefHeight(30);
          rootPane.setPrefWidth(100);
          rootPane.setVgap(20);
          rootPane.setHgap(20);
          rootPane.add(playersListView, 0, 0);
          rootPane.add(teamListView, 1, 0);
       private void populateData()
          playersList.addAll(
                new Player("Adam"), new Player("Alex"), new Player("Alfred"), new Player("Albert"),
                new Player("Brenda"), new Player("Connie"), new Player("Derek"), new Player("Donny"),
                new Player("Lynne"), new Player("Myrtle"), new Player("Rose"), new Player("Rudolph"),
                new Player("Tony"), new Player("Trudy"), new Player("Williams"), new Player("Zach")
          playersListView.setItems(playersList);
       private void initializeComponents()
          playersListView.setPrefSize(250, 290);
          playersListView.setEditable(true);
          playersListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
          playersListView.setCellFactory(new Callback<ListView<Player>, ListCell<Player>>()
             @Override
             public ListCell<Player> call(ListView<Player> playerListView)
                return new ListCell<Player>()
                   @Override
                   protected void updateItem(Player player, boolean b)
                      super.updateItem(player, b);
                      if (player != null)
                         setText(player.getName());
          teamListView.setPrefSize(250, 290);
          teamListView.setEditable(true);
          teamListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
          teamListView.setCellFactory(new Callback<ListView<Player>, ListCell<Player>>()
             @Override
             public ListCell<Player> call(ListView<Player> playerListView)
                return new ListCell<Player>()
                   @Override
                   protected void updateItem(Player player, boolean b)
                      super.updateItem(player, b);
                      if (player != null)
                         setText(player.getName());

    Yeah, this is a pain. I filed https://javafx-jira.kenai.com/browse/RT-29082 a while back. Go ahead and vote for it if you are inclined...
    I think the issue in your case is that the observable list provided by MultipleSelectionModel.getSelectedItems() is not Serializable. So even if you make your Player class Serializable, the list itself isn't. The first thing I would try, I think, is to make Player implement Serializable and then pass in an ArrayList instead of the observable list. So you can do
    content.put(dataFormat, new ArrayList<Player>(playersListView.getSelectionModel().getSelectedItems()));
    and
    List<Player> player = (List<Player>) dragEvent.getDragboard().getContent(dataFormat);
    teamListView.getItems().addAll(player);
    If that doesn't work, a workaround is just to store the "dragged list" in a property:
    final ListProperty<Player> draggedPlayers = new SimpleListProperty<Player>();
    // Drag detected handler:
    content.putString("players");
    draggedPlayers.set(playersListView.getSelectionMode().getSelectedItems());
    // Drag dropped handler:
    if (dragboard.hasString() && dragboard.getString().equals("players")) {
         teamListView.getItems().addAll(draggedPlayers.get());
         draggedPlayers.set(null);

  • Drag & drop item within Tree not working

    Hi,
    I want to be able to drag & drop items within a tree but
    items cannot move accross branches
    It can only be moved within its branch.
    For this I have a condition in dragDrop(event) handler.
    When i drag item it does not move accross branches which is
    intended but when i drop within its branch
    on a different location,
    the item does
    not get dropped
    Though i have dragMoveEnabled set to true.
    my code looks like this:
    private function onDragDrop(event:DragEvent):void {
    var dropTarget:Tree = Tree(event.currentTarget);
    var node:XML = myTree.selectedItem as XML;
    var p:*;
    p = node.parent();
    if(node.parent().@label != "sameBranch") {
    return;
    } else {
    // drop target.
    Do i need to do anything else...
    Please advice.
    Thanks
    Lucky

    topping up, still did not find a way to do...
    but i have handled all tree events like dragEnter and
    dragDrop as described in the flex doc.
    Has anyone faced a similar issue...

  • Drag & Drop, call a method if list changes.

    Hi there,
    I have two spark lists,backed up by Array Collections, both of which accept drag & drop either to move objects between them or to reorder within the lists. I have a method which is called on drop which resets some properties of the object to 0, this works as expected...
    protected function list_dragDropHandler(event:DragEvent):void
         if(event.action != DragManager.NONE)
              var item:Object = event.dragSource.dataForFormat("itemsByIndex")[0];
              item.someProperty = 0;
                    item.someOtherProperty = 0;
    What I would like to do is only call this method only when the objects are moved to another list, currently it is called when I reorder within the same list too, could someone please point me in the right direction with this?
    Many Thanks,
    J.

    Ned,
    Thanks for your prompt reply, you gave me the idea I needed here. As I'm dragging things about by their item renderers a creationComplete is fired when they end up in new places, I used a mouseDown event (This happens when one drags, it's as good an event as any to use I guess) to grab the current list and I compare that to the list I get when creationComplete fires. These are stored in the object and compared by the dragDrop event handler...
    Probably an inelegant take on what you were suggesting, but it works...
    J.

  • Error #1069: TextField Drag/Drop

    I have created a movieclip which I create instances of at
    runtime by clicking a button, these movieclips all have the name
    aCloud# where # is the instance number.
    My trouble is that the movie clip has a dynamic text box slap
    in the middle of it which isn't working with my drag and drop
    function. If I grip the cloud around the edges, the drag drop
    works. if I click the middle it does not and gives the following
    error in the output window
    ReferenceError: Error #1069: Property dropTarget not found on
    flash.text.TextField and there is no default value at
    Suite_fla::MainTimeline/myDragHandler()
    Here is the myDragHandler function which does the down click
    handler part I also have an up handler which does stopDrag() but
    this does the same thing giving me two errors for each click.
    function myDragHandler(event:MouseEvent):void
    var object = event.target;
    object.startDrag();
    So I need to drag the movie clip even if the user clicks the
    textbox in the middle of it. Any hints or tips would be welcomed.
    thank you.

    in your for loop where you assign the event handlers, try
    setting the mouseChildren property to false on the aCloud
    MovieClips.

  • How to Rearrange components using Drag Drop functionality

    Hi,
    Is it possible to re-arrange the components inside the form using drag drop functionality in RCF?
    There are 3/4 section headers in my screen, user can re-arrange them.
    But as per the RCF document it says, "Drag Drop functionality allows users to drag the value of one component and drop it on to another". It dosent say any thing about component drag-drop.

    Hi,
    there is a componentDragSource element that you use for this. However, persisting the change of location is not handled automatically. I didn't try this, but I assume that using the component drag option gives you access to the UI component itself so you can nest it in another container
    Frank
    Ps.: the drag event always givey you access to the component. This componentDragSource however shows the component when dragging, which is a slightly better indicator if you plan to re-arrange items

  • Drag & Drop ALV row to a picture control

    Hello.  I'm trying to implement drag&drop functionality from an ALV grid to a picture/icon(CL_GUI_PICTURE).  Anyone know if this is possible.  I can't get my events to fire when dragging/dropping.  I have been able to do it from ALV to ALV, but am getting stuck on ALV to Picture.  I want some kind of "shopping cart" functionality like in ME22N, where the user can drag a PO from a list into the "shopping cart" picture/icon.
    Anyone can help?
    Regards,
    Rich Heilman

    Good afternoon!
    I'm trying to do the same, to drag a node of a tree and drop it on a picture control. I have called the set_dragdrop_control and set_dragdrop_picture methods and I'm sure of the set handler statement, but no event is fired.
    Can you help me?
    Thank you,
    Fabiano (from Brazil).

Maybe you are looking for