wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Adding Items to Jlist using JComboBox. Problem with avoiding duplicates. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

Adding Items to Jlist using JComboBox. Problem with avoiding duplicates.

rayan alex
Ranch Hand

Joined: Nov 25, 2012
Posts: 33
    
    1
Hi,

In the following program, Im trying to add some items to Jlist using JComboBox without any duplicates.
I managed to add items with Duplicates, As well as I managed to find duplicates using this condition (combo.getSelectedItem().equals(listModel.getElementAt(i)) )
But when i add else statement, program didnt wiork. Please help me to understand where is the error of this program,
Thank you in advance.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38087
    
  22
Closing as a duplicate of the question in this thread.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Adding Items to Jlist using JComboBox. Problem with avoiding duplicates.
 
Similar Threads
Problem with Adding items from JComboBox to JList
JComboBox and ItemListener
JList SelectionForeground problem when BOLD
Set up Jlist
JList Model Creation / Update