get JavaFX Combo Box Integer Value - Java JavaFX

Java examples for JavaFX:ComboBox

Description

get JavaFX Combo Box Integer Value

Demo Code


//package com.java2s;
import javafx.scene.control.ComboBox;

public class Main {
    public static Integer getComboBoxIntegerValue(ComboBox<String> comboBox) {
        return comboBox.getValue() == null ? Integer.valueOf(comboBox
                .getPromptText()) : Integer.valueOf(comboBox
                .getSelectionModel().getSelectedItem());
    }//from w ww  . j  a v a2s  . c om
}

Related Tutorials