dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Need help to implement an autocomplete in JAVA?

  1. #1
    Join Date
    Jan 2003
    Posts
    23

    Need help to implement an autocomplete in JAVA?

    Hi

    I am a student who is currently working on a project. I need to implement an autocomplete feature in JAVA. This is what the autocomplete feature should do in brief:

    The user will type letters in a textfield. Each time the user types a new letter, the system should compare each letter typed by the user with the words stored in a database.

    If the letter(s) input by the user match with a word from the database, then a kind of box should appear, where the user will select the word.

    For example if the user types "App" in the textfield, then the system will match corresponding words found in the database and a box should appear where the user could select the word (say, the box will display "Apple" and "Applet" - assuming these 2 words are stored in the database)

    If you know how to do it, please email me at pascalnicolasl@yahoo.com

    Thanks in advance!
    Bye from Nicolas.

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    You should realise that we are unlikely to want to write your project for you - what would be the point? What would you learn? What would we gain?

    But we may be able to help...

    How far have you got with this project?

    What, in particular, are you having trouble with?

    Show us the code you have so far (if any).

    Dave


    in the depths, something stirred...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    137
    Hi "Dark",
    Have you tried these web-sites:

    http://www.hotdispatch.com

    http://www.helpshare.com

    You may have better luck there.

    Good Luck,
    Avi.

  4. #4
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    Avi - if he's going to pay people to do his project for him, he might as well buy a fake diploma and save a lot of time...

    Can a virus really make you fat?
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  5. #5
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    137
    Dave,
    Like the insurance salesman says, "the choice is his, I'm only making him aware of the available options".

    Avi.

  6. #6
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    Avi - LOL!

    the heart rears wings, bold and bolder, and hurls for him, oh half hurls Earth for him, off under his feet...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  7. #7
    Join Date
    Jan 2003
    Posts
    9
    I'm not sure you're still looking for help on this but I can give you some info to get you started. Basically your dialog or whatever will need to listen for keyboad events and each time it gets on you will need to do a few things.

    1) Check if your timer is running
    1.1) if it is append the last typed character to a strigbuffer you are building
    1.2) if not, start it and append the character to the stringbuffer
    2) search the database for entries that start with the text stored in the stringbuffer
    3) build up a list of the results
    4) display the results

    now, you need to decide how long you are going to wait on the user before resetting your timer and buffer. When the timer expires you can clear the StringBuffer and kill the timer until the user presses the next key.

    HTH,
    -=- Kevin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)