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

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

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

ListView.getStylesheets介绍

暂无

代码示例

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

@SuppressWarnings("unchecked")
public VLAutoCompletePopupSkin(VLAutocomplete control) {
 this.control = control;
 suggestionList = control.getListPopup();
 control.getListView().getStylesheets().add(AutoCompletionBinding.class.getResource("autocompletion.css").toExternalForm()); //$NON-NLS-1$
 control.getListView().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(control.getListView().getItems())).multiply(LIST_CELL_HEIGHT).add(18));
 // Allowing the user to control ListView width.
 suggestionList.prefWidthProperty().bind(control.widthProperty());
 suggestionList.maxWidthProperty().bind(control.maxWidthProperty());
 suggestionList.minWidthProperty().bind(control.minWidthProperty());
 control.getListView().prefWidthProperty().bind(control.widthProperty());
 control.getListView().maxWidthProperty().bind(control.maxWidthProperty());
 control.getListView().minWidthProperty().bind(control.minWidthProperty());
}

代码示例来源: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();
}

相关文章