javafx.scene.control.ListView.prefHeightProperty()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中javafx.scene.control.ListView.prefHeightProperty()方法的一些代码示例,展示了ListView.prefHeightProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.prefHeightProperty()方法的具体详情如下:
包路径:javafx.scene.control.ListView
类名称:ListView
方法名:prefHeightProperty

ListView.prefHeightProperty介绍

暂无

代码示例

代码示例来源:origin: org.controlsfx/controlsfx

public AutoCompletePopupSkin(AutoCompletePopup<T> control){
  this.control = control;
  suggestionList = new ListView<>(control.getSuggestions());
  suggestionList.getStyleClass().add(AutoCompletePopup.DEFAULT_STYLE_CLASS);
  suggestionList.getStylesheets().add(AutoCompletionBinding.class
      .getResource("autocompletion.css").toExternalForm()); //$NON-NLS-1$
  /**
   * Here we bind the prefHeightProperty to the minimum height between the
   * max visible rows and the current items list. We also add an arbitrary
   * 5 number because when we have only one item we have the vertical
   * scrollBar showing for no reason.
   */
  suggestionList.prefHeightProperty().bind(
      Bindings.min(control.visibleRowCountProperty(), Bindings.size(suggestionList.getItems()))
      .multiply(LIST_CELL_HEIGHT).add(18));
  suggestionList.setCellFactory(TextFieldListCell.forListView(control.getConverter()));
  
  //Allowing the user to control ListView width.
  suggestionList.prefWidthProperty().bind(control.prefWidthProperty());
  suggestionList.maxWidthProperty().bind(control.maxWidthProperty());
  suggestionList.minWidthProperty().bind(control.minWidthProperty());
  registerEventListener();
}

代码示例来源:origin: com.github.almasb/fxgl-base

list.prefHeightProperty().bind(Bindings.size(list.getItems()).multiply(FONT_SIZE));

相关文章