• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JCombo+JList problem

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Im developing a chat application. I have a 'Send -to' JCombo box, which is populated with several 100 people who have logged into the chat. Now the JComboBox automatically listens to the 'first key char'. For instance if the JCombo contains the following names the respective order : Ajai, Ajith, Amar, Amay, Mary, Mathew...... etc. So when i type the letter 'A', focus automatically comes to Ajai, but to go to Amay i need to scroll 4 times. But instead if my combo could listen to several subsequent keys, like if i type 'A' follwed by 'm' and then 'a' (all continuosly) then focus could go to 'Amay'. How can i implement this feature. I thinks that this is quite a challenging issue. Can any of u people help me out please.
Its quite Urgent
Waiting for ur replies
regards
Saj
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sajee,
The tough part of that approach is when to start and stop listening. You would need some kind of timer between keys to avoid problems. For example:
Person1: find first A name, then sometime later find first B name, again later find first E name.
Person2: find first Ab name, then sometime later find first E name.
Person3: find first Abe name.
A program would need to distinguish between the three choices. It is analogous to multi-clicking mouse buttons.
When I have to do something like this I will use a textfield along with an associated list. That way the user can see the entire search string and can add or modify it whenever they want.
I can either use an input listener and search after each letter or use an action listener and search only when return is hit.
Regards,
Manfred.
 
reply
    Bookmark Topic Watch Topic
  • New Topic