Here you can find the source of resetComboBoxInfo(JComboBox
private static void resetComboBoxInfo(JComboBox<String> jComboBoxField, ArrayList<String> comboBoxArray, String expression)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.util.ArrayList; public class Main { private static void resetComboBoxInfo(JComboBox<String> jComboBoxField, ArrayList<String> comboBoxArray, String expression) {//from ww w. jav a 2 s . c om if (comboBoxArray.contains(expression)) { jComboBoxField.setSelectedItem(expression); } else { jComboBoxField.setSelectedItem(expression.substring(expression.indexOf(".") + 1, expression.length())); } } }