Package javafx.geometry

Examples of javafx.geometry.Point2D


    }

    @Override
    public FxRobot moveTo(double x,
                          double y) {
        return moveTo(pointFor(new Point2D(x, y)));
    }
View Full Code Here


        return keyCode.impl_getCode();
    }

    private Point2D convertFromCoordinates(int x,
                                           int y) {
        return new Point2D(x, y);
    }
View Full Code Here

    private boolean isAwtEnvironmentHeadless() {
        return GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance();
    }

    private Point2D convertFromAwtPoint(Point awtPoint) {
        return new Point2D(awtPoint.getX(), awtPoint.getY());
    }
View Full Code Here

    //---------------------------------------------------------------------------------------------

    @Test
    public void moveTo_a_point_within_10_pixels() {
        // given:
        Point2D sourcePoint = new Point2D(0, 0);
        given(baseRobot.retrieveMouse()).willReturn(sourcePoint);

        // and:
        Point2D targetPoint = new Point2D(10, 0);
        PointQuery pointQuery = mock(PointQuery.class);
        given(pointQuery.query()).willReturn(targetPoint);

        // when:
        moveRobot.moveTo(pointQuery);

        // then:
        for (double x = 0.0; x <= 9.0; x++) {
            verify(baseRobot, times(1)).moveMouse(new Point2D(x, 0));
        }
        verify(baseRobot, times(2)).moveMouse(new Point2D(10, 0));
        verify(baseRobot, times(2)).awaitEvents();
    }
View Full Code Here

    }

    @Test
    public void moveTo_a_point_within_1000_pixels() {
        // given:
        Point2D sourcePoint = new Point2D(0, 0);
        given(baseRobot.retrieveMouse()).willReturn(sourcePoint);

        // and:
        Point2D targetPoint = new Point2D(1000, 0);
        PointQuery pointQuery = mock(PointQuery.class);
        given(pointQuery.query()).willReturn(targetPoint);

        // when:
        moveRobot.moveTo(pointQuery);
View Full Code Here

    }

    @Test
    public void moveTo_should_move_to_moved_target_point() {
        // given:
        Point2D sourcePoint = new Point2D(0, 0);
        given(baseRobot.retrieveMouse()).willReturn(sourcePoint);

        // and:
        Point2D targetPoint = new Point2D(10, 0);
        Point2D movedTargetPoint = new Point2D(20, 0);
        PointQuery pointQuery = mock(PointQuery.class);
        given(pointQuery.query()).willReturn(targetPoint, movedTargetPoint);

        // when:
        moveRobot.moveTo(pointQuery);
View Full Code Here

    }

    @Test
    public void moveBy_a_distance_of_10_pixels() {
        // given:
        Point2D sourcePoint = new Point2D(0, 0);
        given(baseRobot.retrieveMouse()).willReturn(sourcePoint);

        // when:
        Point2D targetPoint = new Point2D(10, 0);
        moveRobot.moveBy(10, 0);

        // then:
        verify(baseRobot, times(10)).moveMouse(not(eq(targetPoint)));
        verify(baseRobot, times(1)).moveMouse(targetPoint);
View Full Code Here

    }

    @Test
    public void moveBy_a_distance_of_1000_pixels() {
        // given:
        Point2D sourcePoint = new Point2D(0, 0);
        given(baseRobot.retrieveMouse()).willReturn(sourcePoint);

        // when:
        Point2D targetPoint = new Point2D(1000, 0);
        moveRobot.moveBy(1000, 0);

        // then:
        verify(baseRobot, times(200)).moveMouse(not(eq(targetPoint)));
        verify(baseRobot, times(1)).moveMouse(targetPoint);
View Full Code Here

        }
        moveNodes.add(added);
        added.setOnMousePressed(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent e) {
                currentMoveNode = added;
                moveStartPoint = new Point2D(e.getScreenX(), e.getScreenY());
                e.consume();
            }
        });

        added.setOnMouseDragged(new MoveNodeDraggedEventHandler(added));
View Full Code Here

                if (currentResizeHandle == null) {
                    startX = getScene().getWindow().getX();
                    startY = getScene().getWindow().getY();
                    startWidth = getScene().getWindow().getWidth();
                    startHeight = getScene().getWindow().getHeight();
                    moveStartPoint = new Point2D(e.getScreenX(), e.getScreenY());
                    currentResizeHandle = handle.getCursor();
                    e.consume();
                }
            }
        });
View Full Code Here

TOP

Related Classes of javafx.geometry.Point2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.