By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

search button

P: 20
I have this search button working for the most part. I would like it if some one could take a look at it and let me know what I am doing wrong it though. Basically I want it to display movie not found if the movie is not found and can not seem to get it right.

Expand|Select|Wrap|Line Numbers
  1.  btnSearch.addActionListener(new ActionListener(){
  2.           public void actionPerformed(ActionEvent ae){
  3.               String Search =JOptionPane.showInputDialog("Enter name of Movie");
  4.               int x =0;
  5.               for(x = 0; x < dvds.size(); x++)
  6.          {
  7.               DVD dvd = (DVD)dvds.get(x);
  8.           System.out.println("title= "+dvd.title+", search = " +Search);
  9.              if(dvd.title.equals(dvd.title))
  10.                if(dvd.title.trim().equalsIgnoreCase(Search.trim()));
  11.             {
  12.              list.setSelectedIndex(x);
  13.         break;
  14.            }
  15.          }
  16.             if(x == dvds.size()) JOptionPane.showInputDialog("Movie not found.");
  17.  
  18.         }
  19.    });
Nov 21 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.