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

The following examples show how to use javafx.scene.layout.Region#setMinHeight() . 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: ScreenManager.java    From HubTurbo with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Calculates a stage's boundaries based on the screen information given as argument. If the list of screens
 * is empty, then the boundaries will have the default value of Region.USE_COMPUTED_SIZE (-1.0).
 *
 * @param intersectingScreenBounds A list of screens, which should be non-empty
 * @return A Region object containing relevant information in the maxHeight, minHeight and maxWidth fields.
 */
public static Region getStageBounds(List<Rectangle2D> intersectingScreenBounds) {
    DoubleSummaryStatistics occupyingHeights = intersectingScreenBounds.stream()
            .mapToDouble(Rectangle2D::getHeight)
            .summaryStatistics();

    double maxHeight = occupyingHeights.getMax();
    double minHeight = occupyingHeights.getMin();
    double sumWidths = intersectingScreenBounds.stream().mapToDouble(Rectangle2D::getWidth).sum();

    Region stageBounds = new Region();
    if (maxHeight >= 0 && minHeight >= 0) {
        stageBounds.setMaxHeight(maxHeight);
        stageBounds.setMinHeight(minHeight);
        stageBounds.setMaxWidth(sumWidths);
    }

    return stageBounds;
}
 
Example 2
Source File: Workbench.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
private void bindDrawerHeight(Region drawer) {
  drawer.setMinHeight(0); // make sure minHeight isn't larger than maxHeight
  drawer.maxHeightProperty().bind(
      Bindings.createDoubleBinding(
          () -> {
            double computedHeight = drawer.prefHeight(-1);
            // calculate the height the drawer can take up without being so large that it can't be
            // hidden anymore by clicking on the GlassPane (GlassPane covers minimum of 10%)
            double maxDrawerHeight = heightProperty().get() * 0.9;
            return Math.min(computedHeight, maxDrawerHeight);
          }, drawer.maxHeightProperty(), heightProperty()
      )
  );
}
 
Example 3
Source File: TemplateField.java    From pattypan with MIT License 5 votes vote down vote up
public VBox getRow() {
  Region spacer = new Region();
  spacer.setMinWidth(20);

  VBox vb = new VBox(5);
  HBox hb = new HBox(10);
  HBox hbCheckbox = new HBox(10);

  valueText.setText(Settings.getSetting("var-" + name + "-value"));
  value = Settings.getSetting("var-" + name + "-value");
  setSelection(Settings.getSetting("var-" + name + "-selection"));

  hb.getChildren().addAll(labelElement,
          buttonYes, buttonConst, buttonNo,
          spacer, valueText, new Region());
  vb.getChildren().add(hb);

  if (name.equals("date")) {
    Region r = new Region();
    r.setMaxWidth(622);
    r.setPrefWidth(622);
    r.setMinWidth(420);
    r.setMinHeight(30);

    CheckBox checkbox = new CheckBox(Util.text("choose-columns-exif"));
    checkbox.setMaxWidth(500);
    checkbox.setPrefWidth(500);
    checkbox.setMinWidth(305);
    checkbox.setSelected(Settings.getSetting("exifDate").equals("true"));
    checkbox.setOnAction((ActionEvent e) -> {
      Settings.setSetting("exifDate", checkbox.isSelected() ? "true" : "");
    });

    hbCheckbox.getChildren().addAll(r, checkbox);
    vb.getChildren().add(hbCheckbox);
  }

  return vb;
}
 
Example 4
Source File: UIUtils.java    From SONDY with GNU General Public License v3.0 5 votes vote down vote up
public static void setSize(final Region region, int width, int height){
    region.setPrefSize(width, height);
    region.setMinWidth(width);
    region.setMaxWidth(width);
    region.setMinHeight(height);
    region.setMaxHeight(height);
}