views:

13

answers:

1

I want th auto generate values for the empId (or empName) when inserting values to the jtextfield

I went through the Java2sAutoTextField class but I can't add it in to a jframe.

Here's a part of code I extracted from here:

List possible = new ArrayList();  
possible.add("Austria");  
possible.add("Italy");  
possible.add("Croatia");  
possible.add("Hungary");  
Java2sAutoTextField autoCompleter = new Java2sAutoTextField(possible);

i dont know how to put the above coding into the jtextfield

Also I tried out JSuggestField, but I can't add it from netbeans palette.
Any assistance is appreciated.

A: 

Done! i just had to implement the jtextfield as

 List possible = new ArrayList();
    possible.add("");
    possible.add("Austria");
    possible.add("Italy");
    possible.add("Croatia");
    possible.add("Hungary");

 jTextField2 = new Java2sAutoTextField(possible);
Nipuna Silva