Search
hi,
I am developing a media player using JMF, and at present am stuck with search. I have a list box that contains all the songs, that are present in the system, and am also giving a textbox for the user to search any song from the list box. And the problem with search is that, I want to perform search on any part of the song name, i.e, for example, if I have songs like
abc
bcdxy
cd
xyz
and if the user types cd and leaves, then the list box should return
bcdxy
cd
and i have written the code as
privatevoid jTextField1KeyTyped(java.awt.event.KeyEvent evt){
System.out.println("Munda Kalappa");
int lcnt = ((DefaultListModel)jList1.getModel()).getSize();
String search = jTextField1.getText();
System.out.println(search);
String currser;
if(search !=null){
for(int i = 0; i < lcnt; i++){
currser = ((DefaultListModel)jList1.getModel()).getElementAt(i).toString();
if(!currser.contains(search)){
((DefaultListModel)jList1.getModel()).remove(i);
lcnt = lcnt - 1;
}
}
}
}
but it haven't worked properly, can any one tell me a way, and if possible any new techniques...

