tags:

views:

24

answers:

2

I am having a form. I want to show user suggestions about the name of the security he can enter. For the same I want to use the values of securities that I have installed in my Oracle Database.

I want to do something like this, if user enters a, he should get all security names below the text field which starts from a, when user selects anyone of them, then the text field must show the selected values.

Thanks in Advance.

A: 

I'd suggest a trie. They are great for things like predicive text and auto complete.

Get all the valid security names and put them into the trie, then query the trie with whatever prefix the use has entered and it will give you all the matching names.

Note that Java doesn't come with a Trie implementation itself buy it would be pretty easy to write your own or borrow one, for eg from here; http://forums.sun.com/thread.jspa?threadID=5295936

Edit: You didn't say if this was going to be on the web or desktop (eg Swing)....

Qwerky
A: 

You need autocomplete enabled text field. There's a tutorial how to build one. Even better, use jQuery java script library for this and many other features.

Boris Pavlović
I tried the example but it didn't work for me, why I don't know but it didn't. Thanks anyways.
Logan