You're adding a new ListSelectionListener
every time a double mouse click event occurs. Each one of these will respond to single mouse clicks. You can just use a MouseListener
on its own:
subCategoryList.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 2) {
String selectedValue = subCategoryList.getSelectedValue();
// do stuff with selectedValue...
}
}
});