GraphicsBuilder: dragging a shape - No Fluff Just Stuff

GraphicsBuilder: dragging a shape

Posted by: Andres Almiray on December 25, 2007

Taking a break from the Holidays I managed to fix local and global transformations among other things, which enable a simple shape to be dragged with little effort, let's see a "live" example this time



If the animation runs slow is because I'm still getting familiar with Wink's options. Here is the code for the example
You'll notice two interesting properties on the event received in dragMe, which works as a GraphicaInputListener:
  • event: the mouse or key event
  • sourceShape: the shape operation where the event took place
You'll also notice that as the mouse moves over the blue rectangle, the red rectangle is not dragged anymore, because the blue one is drawn after the red one, getting first pick on events if they happen to share a space. I'm still looking for and option to enable usual calls as sendToFront or sendToBack into GraphicsPanel.

Groovy Holidays!

Update: apologies if you can't see the flash animation on IE, JRoller doesn't allow .swf as extension on file uploads I had to change it to .png, besides IE sucks big time :-P the animation works perfectly on Firefox though. I'd look for an alternative.
Andres Almiray

About Andres Almiray

Andres is a Java/Groovy developer and a Java Champion with more than 20 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated on popular projects like Groovy, Griffon, and DbUnit, as well as starting his own projects (Json-lib, EZMorph, GraphicsBuilder, JideBuilder). Founding member of the Griffon framework and Hackergarten community event. https://ch.linkedin.com/in/aalmiray

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »