0

I have problem with my combobox. When I select an item from my combobox it does not go to my addSelectionListener except for the first time when the program starts. How to make it take the user's selection.

here is the code:

private Tirage tirage;
private ComboBox<Tirage> comboBoxTir2;
List<Tirage> tirages;

    tirages = tirageService.findByTirageFutur(produit.getId(), envService.getDateLogique());
    comboBoxTir2 = new ComboBox<>();
    comboBoxTir2.setItems(tirages);
    comboBoxTir2.setItemCaptionGenerator(Tirage::getNoTirage);

    comboBoxTir2.addSelectionListener(event -> {
        tirage = event.getValue();
    });
    sectionVerticalPage.addComponent(comboBoxTir2);

Can anyone help me ?

Junon
  • 1
  • How do you figure out the listener is called only once? – Morfic Apr 12 '18 at 23:43
  • I went into debug mode – Junon Apr 13 '18 at 01:38
  • That should defenitlly work. Can you make a SSCCE, so we can reproduce the issue? – Steffen Harbich Apr 13 '18 at 06:25
  • My list of tirages comes from a query from a table. – Junon Apr 16 '18 at 14:04
  • I have 3 combobox in my application. – Junon Apr 16 '18 at 14:05
  • First combox box of product wich is list of product from a table. When the user select a product the comboxBox of tirages gets all the tirages for that product. The setItems for the tirage comboBox changes depending of the product. The Product comboBox works fine and go to the addSelectionListerner code. But the tirage comboBox goes the first time and never go the addSelectionListener after. The List of Tirages comes from a JPA Query. Could it be the cause of my problem? – Junon Apr 16 '18 at 14:14

0 Answers0