Java Code Examples for javafx.geometry.Point2D#toString()

The following examples show how to use javafx.geometry.Point2D#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesktopPane.java    From desktoppanefx with Apache License 2.0 6 votes vote down vote up
public void placeInternalWindowNoResize(InternalWindow internalWindow, Point2D point) {
    double containerWidth = internalWindowContainer.getLayoutBounds().getWidth();
    double containerHeight = internalWindowContainer.getLayoutBounds().getHeight();

    if (containerWidth > point.getX() && containerHeight > point.getY()) {
        if (containerWidth - point.getX() >= 40 && containerHeight - point.getY() >= 40) {
            internalWindow.setLayoutX(point.getX());
            internalWindow.setLayoutY(point.getY());
        } else {
            throw new PositionOutOfBoundsException(
                "Tried to snapTo MDI Window with ID " + internalWindow.getId() +
                    " at a coordinate " + point.toString() +
                    " that is too close to the edge of the parent of size " +
                    containerWidth + "px x " + containerHeight + "px " +
                    " for user to comfortably grab the title bar with the mouse.");
        }
    } else {
        throw new PositionOutOfBoundsException(
            "Tried to snapTo MDI Window with ID " + internalWindow.getId() +
                " at a coordinate " + point.toString() +
                " that is beyond current size of the MDI container " +
                containerWidth + "px x " + containerHeight + "px.");
    }

}
 
Example 2
Source File: DesktopPane.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
public void placeInternalWindow(InternalWindow internalWindow, Point2D point) {
    double windowsWidth = internalWindow.getLayoutBounds().getWidth();
    double windowsHeight = internalWindow.getLayoutBounds().getHeight();
    internalWindow.setPrefSize(windowsWidth, windowsHeight);

    double containerWidth = internalWindowContainer.getLayoutBounds().getWidth();
    double containerHeight = internalWindowContainer.getLayoutBounds().getHeight();
    if (containerWidth <= point.getX() || containerHeight <= point.getY()) {
        throw new PositionOutOfBoundsException(
            "Tried to snapTo MDI Window with ID " + internalWindow.getId() +
                " at a coordinate " + point.toString() +
                " that is beyond current size of the MDI container " +
                containerWidth + "px x " + containerHeight + "px."
        );
    }

    if ((containerWidth - point.getX() < 40) ||
        (containerHeight - point.getY() < 40)) {
        throw new PositionOutOfBoundsException(
            "Tried to snapTo MDI Window with ID " + internalWindow.getId() +
                " at a coordinate " + point.toString() +
                " that is too close to the edge of the parent of size " +
                containerWidth + "px x " + containerHeight + "px " +
                " for user to comfortably grab the title bar with the mouse."
        );
    }

    internalWindow.setLayoutX((int) point.getX());
    internalWindow.setLayoutY((int) point.getY());
}