import javafx.application.Application; import javafx.application.Platform; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.ContentDisplay; import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.scene.layout.HBox; import javafx.scene.text.Font; import javafx.stage.Stage; import javafx.util.Callback; import java.util.concurrent.TimeUnit; public class ComboBoxBindingApp extends Application { final static int INITIAL_FONT_SIZE = 8; final static int MAX_FONT_SIZE = 36; public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { final ComboBox cmb = new ComboBox(); cmb.setCellFactory(new Callback, ListCell>() { @Override public ListCell call(ListView param) { return new ListCell() { { setContentDisplay(ContentDisplay.TEXT_ONLY); } @Override protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setText(null); } else { setText(item); setFont(new Font(Double.valueOf(item))); } } }; } }); HBox root = new HBox(10f); Button btn = new Button("Populate ComboBox"); btn.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { for (int i = INITIAL_FONT_SIZE; i <= MAX_FONT_SIZE; i += 2) { cmb.getItems().add(String.valueOf(i)); } } }); Button btnClear = new Button("Clear"); btnClear.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { cmb.getItems().clear(); } }); Button btnSetEditable = new Button("Set editable"); btnSetEditable.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { //cmb.setEditable(true); new Thread(new Runnable() { @Override public void run() { try { TimeUnit.MILLISECONDS.sleep(256); } catch (InterruptedException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } Platform.runLater(new Runnable() { @Override public void run() { System.err.println("Binding editable property"); ObservableValue _editableProperty = new SimpleBooleanProperty(true); cmb.editableProperty().bind(_editableProperty); } }); } }).start(); } }); root.getChildren().addAll(cmb, btn, btnClear, btnSetEditable); Scene scene = new Scene(root, 500, 200); primaryStage.setScene(scene); primaryStage.show(); } }