简体   繁体   English

JavaFX FXML创建组件/控件

[英]JavaFX FXML create component/control

How to create custom control like Pagination , ProgressIndicator etc. 如何创建自定义控件,例如PaginationProgressIndicator等。

Using JavaFX SceneBuilder Custom component can be created but its FXML contains all hierarchy of tags . 使用JavaFX SceneBuilder可以创建自定义组件,但是其FXML包含所有标记层次结构。 But Pagination does not contains hierarchy of tags (ex button , list etc) , it contains single tag <pagination> with some attribute . 但是Pagination不包含标签的层次结构(例如,按钮,列表等),它包含具有某些属性的单个标签<pagination>

So my question is that how to create components like pagination that does not show its internal tag hierarchy ? 所以我的问题是,如何创建诸如分页之类的不显示其内部标签层次结构的组件?

I asked for a tutorial some time ago, but unfortunately the issue is still open: https://bugs.openjdk.java.net/browse/JDK-8090885 我前段时间要求提供一个教程,但是不幸的是,这个问题仍然存在: https : //bugs.openjdk.java.net/browse/JDK-8090885

Basically you'll need to: 基本上,您需要:

  • provide a class which extends Control and defines the interface 提供扩展Control并定义接口的类
  • provide a subclass of SkinBase for this control to provide the content 提供此控件的SkinBase子类以提供内容
  • provide a CSS (now optionally, I think) 提供CSS(我认为现在是可选的)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM