package com.oracle.javafx;

import javafx.application.Application; 
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene; 
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.stage.Stage; 

public class MainDemo extends Application { 

    @Override 
    public void start(Stage stage) { 
        ComboBox box = new ComboBox<>(); 
        ObservableList<Label> list = FXCollections.observableArrayList(); 
        for (int i = 0; i < 8; i++) { 
            list.add(new Label("This is node #" + i)); 
        } 
        box.setItems(list); 
        box.setVisibleRowCount(4); 
        Pane sp = new Pane(); 
        sp.getChildren().add(box); 
        Scene scene = new Scene(sp, 800, 600); 
        stage.setScene(scene); 
        stage.show(); 
    } 

    public static void main(String[] args) { 
        launch(); 
    } 
} 