问题
i have ComboBox cbx and a TabPane Contains Tabs (tab: t) and a button b1. So on click on this button b1, it adds a new tab t in the TabPane and it adds a new item in the ComboBox cbx contains the same name of the tab. The problem is i don't know how to get the item from cbx and much the name of the item with the same name of the tab and then Do something so how i can do this with javafx and thanks very much :)
回答1:
Take a look at the API: http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/ComboBox.html
There's a comboBox.getValue() method which gives you the selected item.
来源:https://stackoverflow.com/questions/30572918/how-to-get-the-selected-item-from-a-combobox-in-javafx