I finally got a chance to blog on how to embed a JavaFX scene in a  
Swing application. Please try it out and let me know if I missed  
anything.

http://blogs.sun.com/javafx/entry/how_to_use_javafx_in


Thanks,
        Josh


On Dec 14, 2008, at 1:52 PM, Andres Almiray wrote:

>
> Then you'll be pleased to know that GraphicsBuilder provides D&D
> support with a simple property "autoDrag", you can also attach extra
> event handlers during drag
>
> http://groovy.codehaus.org/GraphicsBuilder+-+Groodle3+-+Screencast
>
> On Dec 7, 9:52 am, "Adam G." <[email protected]> wrote:
>> Ok, I will just post it again here, because the page I created has
>> been deleted...
>>
>> After the 1.0 release I started to download the SDK, the NetBeans
>> plugins and wanted to begin developing. As or main applications deals
>> with graph based interfaces, I wanted to test how hard it would be to
>> implement drag'n'drop (in one window, so no transfer objects or what
>> so
>> ever). I remembered from my first try outs with JavaFX that there was
>> this very handy JavaFX Pad. So I have downloaded it
>> (http://download.java.net/general/openjfx/demos/javafxpad.jnlp) and
>> there was already the first Node with dragging and moving around
>> support. Ok, that was cool! So I took a look into the code and  
>> checked
>> out the lines where the magic happens:
>>
>> var x = 0
>> var y = 0
>>
>> onMouseDragged: operation(e) {
>>         // updating x and y will move the group
>>         // since a translation transform is bound to them
>>         x += e.localDragTranslation.x;
>>         y += e.localDragTranslation.y;
>>
>> }
>>
>> Ok, quite easy. Copied that into NetBeans and the only thing that I
>> got
>> were errors. After looking around I have found other similar examples
>> and I have found the type of e, that is CanvasMouseEvent. Ok, added
>> that
>> and nothing. After searching the whole internet  ;)  I have found  
>> some
>> comments, that the API has changed. So the classes in the package
>> javafx.ui.* have been moved or replaced. The CanvasMouseEvent was one
>> of
>> the classes that have been replaced and not available anymore. So how
>> could I do that now? Again after, some hours of google I have found
>> this
>> very up to date official 
>> tutorial:http://javafx.com/samples/DragAndDrop/index.html
>>
>> public-init var maxX = 200;
>> public-init var maxY = 200;
>> var startX = 0.0;
>> var startY = 0.0;
>>
>> override var onMousePressed = function(e:MouseEvent):Void {
>>     startX = e.sceneX-translateX;
>>     startY = e.sceneY-translateY;
>>
>> }
>>
>> override var onMouseDragged = function(e:MouseEvent):Void {
>>     var tx = e.sceneX-startX;
>>     if(tx < 0) { tx = 0; }
>>     if(tx > maxX-image.width) { tx = maxX-image.width; }
>>     translateX = tx;
>>
>>     var ty = e.sceneY-startY;
>>     if(ty < 0) { ty = 0; }
>>     if(ty > maxY-image.height) { ty = maxY-image.height; }
>>     translateY = ty;
>>
>> }
>>
>> So from the quite elegant methode above I have to change my code to
>> look like this. The very handy field
>> localDragTranslation is gone. Why? Did I miss something? I mean, I am
>> really willing to try JavaFX out and
>> even use it. But the first experience is anything else than a  
>> success.
>>
>> Cheers,
>>  Adam Giemza
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to