Adds a zoom behavior (zoom by scroll) to the specified JavaFX node. - Java JavaFX

Java examples for JavaFX:Animation

Description

Adds a zoom behavior (zoom by scroll) to the specified JavaFX node.

Demo Code


import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.ScrollEvent;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Translate;

public class Main{
    /**// w w w .j a  v  a2s.  c  o m
     * Adds a zoom behavior (zoom by scroll) to the specified node.
     * @param n node
     * @param eventReceiver receiver of the event
     */
    public static void addZoomBehavior(Node n, Node eventReceiver) {
        eventReceiver.addEventHandler(ScrollEvent.ANY, new ZoomBehavior(n));
    }
}

Related Tutorials