How to detect when a ComboBox's menu item is really selected by the user?

How to detect when a ComboBox's menu item is really selected by the user?

I'm currently facing the situation that if a user clicks on my ComboBox and moves the selection with his keys, the selection listener will keep being called, although for all purposes a choice was still not really made by the user.

I'm currently facing the situation that if a user clicks on my ComboBox and moves the selection with his keys, the selection listener will keep being called, although for all purposes a choice was still not really made by the user.

How can I distinguish those "intermediate" selections from the proper, final, user selection in my ComboBox?

I tried looking at variables such as isPopupVisible or even playing with PopupMenuListener but they didn't seem to really help.

Thanks

Edit: Example of the offending code:

public class Main extends JFrame {    
    public Main() {
        setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));

    JComboBox<String> comboBox = new JComboBox<>();
    comboBox.setModel(new DefaultComboBoxModel<>(new String[] { "a", "b", "c" }));
    comboBox.addItemListener(e -> {
        System.out.println(e.getItem());
    });
    add(comboBox);
}    

}


java

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Java Core (2020) | Java for beginners | Brush up your Java Skills | Get Hired

In this video we will learn about all the major concepts that come under Java Core . The course is very carefully designed and is made with keeping simplicit...

Java Multithreading Example | Multithreading in Java

Java Multithreading Tutorial With Example | Multithreading in Java. Multithreading is a process of executing multiple threads simultaneously.

Java File Class Tutorial | Java.io File Class in Java Example

Java File class represents the path of directories and files. It provides the methods for renaming, deleting, and obtaining the properties of file or directory.

Java Hashmap Example | HashMap in Java

Java HashMap is the part of Collections since JDK1.2. Java HashMap provides the underlying implementation of the Map interface of Java.