/* * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. */ import javafx.application.Application; import javafx.collections.FXCollections; import javafx.scene.SceneBuilder; import javafx.scene.control.ChoiceBox; import javafx.scene.control.ChoiceBoxBuilder; import javafx.stage.Stage; import javafx.stage.StageBuilder; import javafx.util.StringConverter; /** * * @author Alexander Kouznetsov */ public class Bug extends Application { public static void main(String[] args) { launch(args); } private ChoiceBox choiceBox; @Override public void start(Stage stage) throws Exception { StageBuilder.create() .scene(SceneBuilder.create() .root(choiceBox = ChoiceBoxBuilder.create() .items(FXCollections.observableArrayList(1., 2., 3.)) .converter(new StringConverter(){ @Override public String toString(Double t) { return t + " via Converter"; } @Override public Double fromString(String string) { throw new UnsupportedOperationException("Not supported yet."); } }) .build()) .build()) .applyTo(stage); choiceBox.getSelectionModel().select(0); stage.show(); } }