Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9080959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:11:57+00:00 2026-06-16T20:11:57+00:00

Very weird problem, I finally managed to distill it into a small piece of

  • 0

Very weird problem, I finally managed to distill it into a small piece of code which demonstrates the problem. I have a pane, which contains 1 group, that groups contains a group which contains some ellipses. The top group has a rotate transform applied to it. The ellipses are made draggable.

Try the below example, drag some ellipses downwards (outside the group’s bounds), you’ll see them disappearing. If you maximize the window, they appear again but you can’t drag them anymore, they don’t receive any events anymore.

Now for the really strange part, there are three ways I can make the problem go away:

  1. don’t apply the transform
  2. remove one ellipse (!?) (I experimented to get to this number, 11)
  3. start ScenicView alongside and select the group containing the ellipses so you can see the bounds of the group

I’m at a total loss here, completely stupefied. Please, does anyone have any idea why this problem is occuring and how to solve it?

Code (JavaFX 2.2.3 and java 1.7.0_09 64bit Windows 7):

import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.geometry.Point2D;
import javafx.scene.Group;
import javafx.scene.GroupBuilder;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.SceneBuilder;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Ellipse;
import javafx.scene.shape.EllipseBuilder;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.RotateBuilder;
import javafx.stage.Stage;

public class DragProblem extends Application {
public static void main(String[] args) {
    launch(args);
}

@Override
public void start(Stage primaryStage) {
    DrawingPane drawingPane = new DrawingPane();
    drawingPane.setStyle("-fx-background-color: darkgrey;");

    Scene scene = SceneBuilder.create().root(drawingPane).width(1280d).height(1024d).build();

    primaryStage.setScene(scene);
    primaryStage.show();
}

public class DrawingPane extends Pane {
    private Group transformedGroup;
    private Group splinePoints;

    public DrawingPane() {
        transformedGroup = GroupBuilder.create().id("transformedGroup").build();

        getChildren().add(transformedGroup);

        addPoints();
        makePointsDraggable();
    }

    public void addPoints() {
        double[] coords = new double[] {
                // comment any one the below x,y coordinates and the problem doesn't occur..
                239.28353881835938, 488.2192687988281,
                245.04466247558594, 505.30169677734375,
                258.56671142578125, 539.49462890625,
                267.2294006347656, 563.618408203125,
                282.89141845703125, 587.84033203125,
                309.6925048828125, 602.2174072265625,
                327.4945068359375, 616.4683227539062,
                345.25445556640625, 633.718994140625,
                371.0416259765625, 649.0819702148438,
                393.78704833984375, 667.402587890625,
                442.67010498046875, 676.0886840820312 };

        splinePoints = GroupBuilder.create().build();
        for (int i = 0; i < coords.length; i += 2) {
            Ellipse ellipse = EllipseBuilder.create().radiusX(3).radiusY(3).centerX(coords[i]).centerY(coords[i + 1]).build();
            splinePoints.getChildren().add(ellipse);
        }

        transformedGroup.getChildren().add(splinePoints);

        Rotate rotateTransform = RotateBuilder.create().build();
        rotateTransform.setPivotX(224);
        rotateTransform.setPivotY(437);
        rotateTransform.setAngle(15);

        // ..or comment this line to prevent the problem occuring
        transformedGroup.getTransforms().add(rotateTransform);
    }

    public void makePointsDraggable() {
        for (final Node n : splinePoints.getChildren()) {
            Ellipse e = (Ellipse) n;
            final NodeDragHandler ellipseDragHandler = new NodeDragHandler(e, transformedGroup);

            e.setOnMousePressed(ellipseDragHandler);
            e.setOnMouseDragged(ellipseDragHandler);
        }
    }
}

public class NodeDragHandler implements EventHandler<MouseEvent> {
    protected final Ellipse node;
    private final Node transformedGroup;

    private double initialX;
    private double initialY;
    private Point2D initial;
    private boolean dragStarted = false;

    public NodeDragHandler(Ellipse node, Group transformedGroup) {
        this.node = node;
        this.transformedGroup = transformedGroup;
    }

    @Override
    public void handle(MouseEvent event) {
        if (!dragStarted) {
            initialX = event.getScreenX();
            initialY = event.getScreenY();

            initial = transformedGroup.localToParent(new Point2D(node.getCenterX(), node.getCenterY()));

            dragStarted = true;
        } else {
            double xDragged = event.getScreenX() - initialX;
            double yDragged = event.getScreenY() - initialY;

            Point2D newPos = new Point2D(initial.getX() + xDragged, initial.getY() + yDragged);

            Point2D p = transformedGroup.parentToLocal(newPos.getX(), newPos.getY());

            node.setCenterX(p.getX());
            node.setCenterY(p.getY());
        }
    }
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:11:59+00:00Added an answer on June 16, 2026 at 8:11 pm

    It’s been acknowledged as a bug in JavaFX and will be solved in 2.2.6, see here. I’ve tested it with the early access release and I can confirm it has been solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very weird problem in the most simple piece of VB.NET code:
I am experiencing a very weird problem: In WPF I have a tabControl which
Hi I have run into a very weird problem. I have a basic chrome
I have a very weird problem I am writing a code that gets data
I have a very weird problem that I can't understand. This is C code:
I have a very weird problem using OpenMP in my C++ code: void update(double
I have a very weird problem with core text, which sometimes randomly and sometimes
I have a very weird problem, I have a markup, which is being treated
I have a very weird problem. I am using PHP, in my PHP code,
So I have a very weird problem. I am writing some code in VB.Net

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.