Class DragResizerUtil


  • public class DragResizerUtil
    extends java.lang.Object
    Resize JavaFX Node objects based on mouse dragging.

    Example code:

     
         Rectangle rectangle = new Rectangle(50, 50);
         rectangle.setFill(Color.BLACK);
    
         DragResizeMod.makeResizable(rectangle, null);
         Pane root = new Pane();
         root.getChildren().add(rectangle);
    
         primaryStage.setScene(new Scene(root, 300, 275));
         primaryStage.show();
     
     
    A note on OnDragResizeEventListener: You need to override OnDragResizeEventListener and
    • perform out of main field bounds check
    • make changes to the node
    (this class will not change anything in node coordinates). There is a default listener that works fine with Canvas, Rectangle and Region-derived Nodes (ie. Pane and most other containers except Control)
    • Method Detail

      • intersect

        protected static boolean intersect​(double side,
                                           double point)
      • isBottomResizeZone

        protected boolean isBottomResizeZone​(javafx.scene.input.MouseEvent event)
      • isInDragZone

        protected boolean isInDragZone​(javafx.scene.input.MouseEvent event)
      • isInResizeZone

        protected boolean isInResizeZone​(javafx.scene.input.MouseEvent event)
      • isLeftResizeZone

        protected static boolean isLeftResizeZone​(javafx.scene.input.MouseEvent event)
      • isRightResizeZone

        protected boolean isRightResizeZone​(javafx.scene.input.MouseEvent event)
      • isTopResizeZone

        protected static boolean isTopResizeZone​(javafx.scene.input.MouseEvent event)
      • resetNodeSize

        protected void resetNodeSize​(javafx.scene.input.MouseEvent evt)
      • setNewInitialEventCoordinates

        protected void setNewInitialEventCoordinates​(javafx.scene.input.MouseEvent event)
      • mouseDragged

        protected void mouseDragged​(javafx.scene.input.MouseEvent event)
      • mouseOver

        protected void mouseOver​(javafx.scene.input.MouseEvent event)
      • mousePressed

        protected void mousePressed​(javafx.scene.input.MouseEvent event)
      • mouseReleased

        protected void mouseReleased​(javafx.scene.input.MouseEvent event)
      • makeResizable

        public static void makeResizable​(javafx.scene.Node node)