1 Reply Latest reply: Mar 30, 2014 3:37 PM by rp0428 RSS

    Drag and Drop Tutorial?

    0bb3e083-d5eb-4263-83a9-d17b197773ef

      Hello, everyone,

       

      I'm looking for a working, relevant drag and drop tutorial. I basically want to take some rectangular shapes and move them to certain locations. For example, I could have the left image turn in to the right image.

       

      image1 image2

       

      I would like have my program let me move these around but never have the objects overlap, so that one part of the rectangle turns red, or maybe the whole thing does (though I'd prefer just the offending location to error). I would also be able to like to rotate these objects if necessary. Can someone give me an adequate tutorial, please? All the ones I've tried have either not worked or been irrelevant.

       

      Thank you,

      --Sabrina--

        • 1. Re: Drag and Drop Tutorial?
          rp0428
          All the ones I've tried have either not worked or been irrelevant.

          Post the links to the ones that you say you have tried.

           

          The Java Tutorials has examples for ALL of the basic functionality including drag and drop and manipulating graphics.

          I would like have my program let me move these around but never have the objects overlap, so that one part of the rectangle turns red, or maybe the whole thing does (though I'd prefer just the offending location to error).

          The Drag and Drop tutorial covers the basics of drag and drop. To prevent overlap you just don't enable the 'drop' operation if you are 'over' the other other object:

          http://docs.oracle.com/javase/tutorial/uiswing/dnd/intro.html

          I would also be able to like to rotate these objects if necessary. Can someone give me an adequate tutorial, please?

          Their are several graphics tutotials in 'The Java Tutorials' trails that show how to rotate, scale, shear, etc.

          http://docs.oracle.com/javase/tutorial/2d/advanced/transforming.html

           

          You need to learn the basic operations first. Complex operations are created by building on the basic ones.