Get input values from JComboBox
问题 How can I get the input for an editable JComboBox . When user gives an input to the combo how I can get the input text from it? 回答1: You need to get the edited text from the combobox editor via combo.getEditor().getItem(). 回答2: If you need the text that is selected on a JComboBox and you are sure it's a String and not any other object, just use something like String text = (String)myCombobox.getSelectedItem() . If the thing you have in your Model is other than a String , then you need to cast