I am looking for a drop-down which will have country name and it’s flag in the list.
I am using below code by using Vaadin-10, unfortunately i am not able to do so please suggest how to achieve this.
ComboBox<Language> cb = new ComboBox<>();
List<Language> language = new ArrayList<>();
Language eng = new Language();
eng.setName("English");
eng.setIcon("icons/img_other_rates.png");
language.add(eng);
cb.setItems(language);
Image image = new Image("icons/img_other_rates.png", "english");
cb.setRenderer(new ComponentRenderer<HorizontalLayout, Language>(lang -> {
HorizontalLayout layout = new HorizontalLayout();
layout.add(image);
layout.add(new Label("En"));
return layout;
}));.
I have attached the picture which show the actual requrements. I have googled and go through many approach but unable to find the exact answer.