Java Code Examples for javafx.scene.layout.Region#prefWidth()

The following examples show how to use javafx.scene.layout.Region#prefWidth() . 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: JFXMasonryPane.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
protected boolean validWidth(BoundingBox box, Region region, double cellW, double gutterX, double gutterY) {
    boolean valid = false;
    if (region.getMinWidth() != -1 && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX < region.getMinWidth()) {
        return false;
    }

    if (region.getPrefWidth() == USE_COMPUTED_SIZE && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX >= region
        .prefWidth(-1)) {
        valid = true;
    }
    if (region.getPrefWidth() != USE_COMPUTED_SIZE && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX >= region
        .getPrefWidth()) {
        valid = true;
    }
    return valid;
}
 
Example 2
Source File: JFXMasonryPane.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
protected double getBLockWidth(Region region) {
    if (region.getMinWidth() != -1) {
        return region.getMinWidth();
    }
    if (region.getPrefWidth() != USE_COMPUTED_SIZE) {
        return region.getPrefWidth();
    } else {
        return region.prefWidth(-1);
    }
}