You should use the equals() method for comparing Strings, not the == operator.
Type: Posts; User: Norm
You should use the equals() method for comparing Strings, not the == operator.
Cross posted at connecting json read method to textfield in class
Its done in a method. You call methods to do some job or task.
One or more methods are contained in a class.
When you call the method that is reading/getting the String pass the variable: textField as a parameter.
theReadMethod(textField); // pass textField to the method
In the method that is doing the...
You could pass a reference to the textfield to the method that is reading the data and it could use that reference to put a String into the textfield.
Yes you could create a method (not a class) that you can call with the line number you want it to read and return.
Yes that sounds like the way to do it.
You can use the Scanner class's nextLine() method to read the lines from the file.
Can you read the lines of the text file, one after the the other?
Can you parse the data on each line into separate tokens using split?
Can you convert a String to a number using an Integer class...
Have you solved your problem?
Or do you have more questions or problems?
Please explain what you are having problems with.
Please explain in more detail.
Are you trying to pick a line by its position in the file? In that case you need to read over all the lines that precede the desired line until you get to the line...
If the lines have tokens/words separated by spaces, you could use the String class's split method to create an array with all the tokens.