String () { final JComboBox comboBox = myXmlInputFile.getComboBox(); final Object currentItem = comboBox.getEditor().getItem(); String s = (String)(currentItem != null ? currentItem : comboBox.getSelectedItem()); return s != null ? s : ""; }