Appending To TextBox, Unique Question?
Okay this is what I want to happen but can't find anything on it.
okay have a text box, User enters a name
User Enters: John
User Presses Enters, String John Goes to File
User Enters: Jo
I want the program to recognize the possibilities of what can come next,
Is there some package or class that allows this to happen?
Appending to a textbox
Basically you are wanting to have the program search through previously entered data and append it into the boxes as selected? The functionality provided by say an addess bar in IE that has inline autocomple on?
I don't know of anything that does this for you, but it shouldn't be too hard to implement yourself. Keep the data entered previously in some data structure, when the user starts typing have it search through the data structure and see if there are any matches to what the current text in the box is. If so append it in there and select the portion that was not enetered by the user. You will have to find out for yourself which events would be best to execute this in.
Note that this could slow down your program somewhat, choosing your data structure carefully could help minimize load.
Alright You understand what i"m tryin to explain, and my problem. Now what do you mean by a data structure, I think i'm still a little tech language inexperienced, I know what methods and constructors are, what's a data structure?
A data structure is the method you use for storing the data. For example, an array is a data structure. For this problem you're going to need a data structure that is capable of storing words in some form or another and allows you to search quickly based on each letter that is entered. I imagine that some kind of tree structure where each node represents a letter would work well.
What the previous poster said is corect, a data structure is something that hold multiple pieces of data.
The code below is by no means complete but should help you get on the right track, hope it helps
ArrayList alTyped = new ArrayList();
//In the event handler for lost focus or ActionEvent
alTyped.add(jtfField.getText());//add what the user just typed
//In Event handler for textfield change event or something like that, or keypressed, I'm not really sure which events you want to use
String fieldText = jtfField.getText();
for(int i = 0; i < alTyped.size(); i++)//traverse the ArrayList
//do comparison here
//for this comparison you will have to have another for loop
//it will traverse the length of the String and compare, look at
//look at String.regionMatches()
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center