'JavaFX search textfield
In the JavaFX Scene Builder there is a text field to search in the library:

Is this a default control (if so I can't find it) or did they simply style a text field?
I tried looking in the source code of the Scene Builder as well, but could not find it.
Solution 1:[1]
There is no premade control to work this way, but you can create one using TextField events.
For example see next code: AutoComplete ComboBox in JavaFX
Solution 2:[2]
We can make our own toolbar 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;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Community |
| Solution 2 | Labeeb |
