在JavaFX Scene Builder中,有一个要在库中搜索的文本字段:
这是默认控件(如果是这样我找不到它),还是只是设置文本字段的样式? 我也尝试查看Scene Builder的源代码,但找不到它。
答案 0 :(得分:0)
没有预制控件可以这种方式工作,但您可以使用TextField事件创建一个。
例如,请参阅下一个代码:AutoComplete ComboBox in JavaFX
答案 1 :(得分:0)
我们可以创建自己的工具栏like this
<ToolBar prefHeight="40.0" prefWidth="349.0" >
<items>
<Button fx:id="buttonCloseSearch" styleClass="buttonSearchClose">
<graphic>
<FontAwesomeIconView styleClass="buttonSearchCloseIcon" />
</graphic>
</Button>
<CustomTextField styleClass="searchField">
<left>
<Label styleClass="searchBoxLabel">
<graphic>
<FontAwesomeIconView styleClass="searchBoxLabelIcon" />
</graphic>
</Label>
</left>
</CustomTextField>
<Button fx:id="buttonUpSearch" styleClass="buttonUpSearch">
<graphic>
<FontAwesomeIconView styleClass="buttonSearchUpIcon" />
</graphic>
</Button>
<Button fx:id="buttonDownSearch" styleClass="buttonDownSearch">
<graphic>
<FontAwesomeIconView styleClass="buttonSearchDownIcon" />
</graphic>
</Button>
<Label text="1 of 2 matchs" />
</items>
</ToolBar>
.buttonSearchCloseIcon {
-glyph-size: 15;
-glyph-name: CLOSE;
}
.buttonSearchUpIcon {
-glyph-size: 15;
-glyph-name: CARET_UP;
}
.buttonSearchDownIcon {
-glyph-size: 15;
-glyph-name: CARET_DOWN;
}
.buttonSearchClose, .buttonUpSearch, .buttonDownSearch {
-fx-background-color: transparent;
-fx-background-insets: 0;
}
.searchBoxLabel {
-fx-padding: 0 2 0 7;
}
.searchBoxLabelIcon {
-glyph-size: 13;
-glyph-name: SEARCH;
}