OK, I have figured out what is going on ... I think ... it is not currCD or else it would not check each element and give the dialog box, that tells me it is moving through the list.

If I put the cdname in the cdnamefield also, it finds that cd and populates the fields as it should.
Why would I have to put it in both places? It seems to be searching the field, not the list ... which is what I think it is set to do, but not exactly what I want to do ....

does that rambling make any sense?

I am just flat out busted. I have done everything I can think of, and this is the closest I can get toworking correctly.
If I put the cd name in the search field AND the cdnamefield the search will find it and populate everything like it should.

I do not understand it. The only thing I can think of is that my search is looking in the text field itself, and when a match is made then pulling in that element.

here is the code

//start at first cd
			[B]currCD = 0;[/B]

			// compare
			JTextField f = searchField; 
			final String s = f.getText(); 
			
			SwingUtilities.invokeLater( new Runnable() 
				{ 
				public void run() 
				{ 
				try 
					{ 
					for(int i = 0; i < listModel.getSize();  i++) 
					{ 
					
					CdwArtist cdEntry = (CdwArtist)listModel.elementAt(i);
         					
					[B]if(cdNameField.getText().equalsIgnoreCase(s))[/B] 
						{ 
						Inventorylist.setSelectedIndex(i); 
						Inventorylist.scrollRectToVisible( Inventorylist.getCellBounds(i,i) );
					
						CdwArtist newCD = (CdwArtist) listModel.get( currCD );
			
						artistField.setText(newCD.getArtist());
						cdNameField.setText(newCD.getName());	
						itemField.setText(String.valueOf(newCD.getItemno()));
						nstockField.setText(String.valueOf(newCD.getNstock()));
						priceField.setText(formatter.format(newCD.getPrice()));
						}
						else
					   {
						JOptionPane.showMessageDialog(null,"No CD Match Found","TryAgain",JOptionPane.INFORMATION_MESSAGE); 
						} 
					} 
				} 
				catch(StringIndexOutOfBoundsException sie) 
				{} 
				} 
				});

I have "tweaked" on the currCD and if lines above to my wits end ... i think therein the problem lies.

Please someone pull me from the depths of despair.

1. Is there any reason for currCD = 0? Do you use it for something?

2. CdwArtist cdEntry = (CdwArtist)listModel.elementAt(i); will retrive data about CD on position "i" of your list.
What is cdNameField.getText() for? Is it the way you retrieve CD name from cdEntry object?
Just checking few lines bellow it is not! cdNameField.setText(newCD.getName());

commented: Yes, he was completely missing all the hints I tried to give him. I really didn't want to just write code for him, but the points just wouldn't stick. +1
commented: Always helpful, even when I am showing little to no progress +1

See comments in the code (prefixed Ez).
This should be a working version, but I just banged it out in a text editor real quick so any syntax errors are yours to enjoy. I also didn't bother changing a couple of things that would make it slightly more efficient (like holding on to the reference of the found CD instead of getting it again) because I didn't want to induce even more confusion over the mechanics.

//start at first cd
//currCD = 0;    // Ez: removed, this has nothing to do with the search

// compare
//JTextField f = searchField;  // Ez: also removed, superfluous
final String searchString = searchField.getText(); 

SwingUtilities.invokeLater( new Runnable() 
{ 
    public void run() 
    { 
        boolean matchFound=false;    // Ez: this is a simple boolean flag for whether match found
        for(int i = 0; i < listModel.getSize();  i++) 
        { 
            CdwArtist cdEntry = (CdwArtist)listModel.elementAt(i);
                    
            if(cdEntry.getName().equalsIgnoreCase(searchString))     // Ez: Yes, you were comparing the cdname field against the search field
            { 
                matchFound=true;
                currCD = i;
                break;
            }
        } 
        // Ez: All you have to do now is check the match flag
        if (matchFound) {
            Inventorylist.setSelectedIndex(i); 
            Inventorylist.scrollRectToVisible( Inventorylist.getCellBounds(i,i) );
        
            CdwArtist newCD = (CdwArtist) listModel.get( currCD );
    
            artistField.setText(newCD.getArtist());
            cdNameField.setText(newCD.getName());    
            itemField.setText(String.valueOf(newCD.getItemno()));
            nstockField.setText(String.valueOf(newCD.getNstock()));
            priceField.setText(formatter.format(newCD.getPrice()));
        }
        else
        {
             // Ez: No match
            JOptionPane.showMessageDialog(null,"No CD Match Found","TryAgain",JOptionPane.INFORMATION_MESSAGE); 
        } 
    } 
});
commented: Best poster out here. Paitence of 10 people. +1

wow. I thought I was so close and I couldn't have been farther off.
My boolean attempts were WAY screwed up!

Changing to cdEntry was something I had played with in one way or another several times, never with any success, but I could have stayed for 100 years the way I was going and would have never even come close on most of it.

You don't know how much I appreciate this. I am feeling a bit dence right now and will probably stay out of here the rest of the night just to go over things and try to improve my future performance. This is all so new, and I think I am just trying too much for not having any more experience than I do ... at the same time, I will never learn if I do not try this stuff.

If it is any consolation, I only have two more methods I am even going to attempt and then I am done until I get back from Mexico in mid August ... so you will done with me for at least that long! :o)

commented: Keep up good work. I'm happy to finaly see somebody who wants to learn. +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.