/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package helloworld;

import javafx.application.Application;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

/**
 *
 * @author jfdenise
 */
public class TestComboBox1 extends Application {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Hello World!");
        TextField tf = new TextField();
        final ComboBox cb = new ComboBox();
        cb.setMaxWidth(100);
        cb.setMinWidth(100);
        cb.setOnShowing(new EventHandler<Event>() {

            @Override
            public void handle(Event arg0) {
                cb.getItems().setAll("" + System.currentTimeMillis());
            }
        });
        
        cb.setEditable(true);

        cb.setPromptText("X");

        VBox vbox = new VBox(10);
        vbox.getChildren().addAll(tf, cb);
        AnchorPane root = new AnchorPane();
        root.getChildren().addAll(vbox);
        primaryStage.setScene(new Scene(root, 300, 250));
        primaryStage.show();
    }
}