[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Multi-touch API
From:       richard.bair () oracle ! com (Richard Bair)
Date:       2012-05-31 0:14:45
Message-ID: 541668E3-E263-4972-AAFD-C76E532DC28E () oracle ! com
[Download RAW message or body]


> > Here's some code written from memory for javaFX
> > 
> > touchSupport = new JavaFxTouchSupport(jfxAppFrame);
> > 
> > touchSupport.addListener(fooNode, new PinchZoomRecogniser(new PinchZoomListener() \
> > { public void beginZoom(event) {
> > }
> > public void updateZoom(event) {
> > }
> > public void finishZoom(event) {
> > }
> > }));
> 
> I'll just state here that having API similar to Swing is not a goal of FX.

Ya, specifically Swing / AWT used this interface-with-multiple-methods approach to \
event handlers / listeners, whereas JavaFX uses a property for each event handler. \
This was done for multiple reasons. One was that mapping this onto a property \
language feature would be really quite nice (at least, it seems to be so :-)). \
Another reason is that it means when we get lambda's in Java, you can use lambda's \
for event handlers, whereas if we had gone with the interface-with-multiple-methods \
then we wouldn't be able to use lambdas. Also from other languages which have lambdas \
/ closures, the property-per-event design allows them to use those lambdas / closures \
quite naturally.

Thanks!
Richard


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic