I'm trying to fetch a set of words stored in a text file into a text field one after the other i.e in my form i have a text field and a button, when i click on the button the word present in the text file must be displayed in the text field and when i click the button again, the second word in the text file must be displayed in the text field and so on. I was able to write a program to fetch a single word but not in a loop. Please guide me with this issue. Thanks in advance.
Using getSource and == inside a method suggests to me you are using that most dreadfully non‑object‑oriented construct addActionListener(this).
Suggestion: There is a piece of hardware which is obstructing your progress with this assignment, and it must be removed. It is long thin and (probably) black, and it connects your computer to the wall. Remove that piece of hardware, and use a pencil paper and eraser to write how you intend to fetch a word from that file, and then set the text in your component. Also read the Scanner documentation.
Joined: Mar 26, 2013
Thanks for your valuable suggestions.. If you are referring the hardware to be my internet connection then probably i wouldn't be able to do this much also without it.. I'm trying to self learn through samples.
Will surely give a thought on your suggestion.
Joined: Oct 13, 2005
The bit of hardware I was thinking of goes to the power supply.
And it is after 12 o’clock, so it is not a 1st April joke.