XComboBox
extends the regular ComboBox
class and enables you to add leading/trailing
nodes inside the ComboBox
. Leading and trailing controls are placed within a styleable container
- see XComboBox CSS Reference. In editable mode the clearable button on the right side allows you to remove any
text input at once.
The screenshot was taken from XComboBoxDemo - the Demo can be downloaded from the link below.
XComboBox combo = new XComboBox<>(FXCollections.observableArrayList("John Doe", "John Meyer", "John Williams"));
combo.setEditable(true);
combo.setPromptText("Username");
combo.addTrailingNode(createInnerButton("Find"));
combo.setPrefWidth(250);
centerPane.getChildren().add(combo);