@RunsInEDT static int matchingItemIndex( final @Nonnull JComboBox comboBox, final @Nonnull TextMatcher matcher, final @Nonnull JComboBoxCellReader cellReader) { Integer result = execute( new GuiQuery<Integer>() { @Override protected @Nullable Integer executeInEDT() { int itemCount = comboBox.getItemCount(); for (int i = 0; i < itemCount; i++) { String value = cellReader.valueAt(comboBox, i); if (value != null && matcher.isMatching(value)) { return i; } } return -1; } }); return Preconditions.checkNotNull(result); }