You are adding a new MouseListener
each time results
is called...
This...
DefaultListModel model = new DefaultListModel();
model.addElement(message);
showOption.setModel(model);
Shows that showOption
is an existing instance of JList
(which is good), but then you do...
MouseListener mouseListener = new MouseAdapter() {
//...
};
showOption.addMouseListener(mouseListener);
Which adds ANOTHER MouseListener
to the JList
, so the each time this method is called, there will another MouseListener
added to the JList
.
Add a single MouseListener
to the JList
when you first create it.