open the file after the user specifies it with jfilechooser. read each line one at a time keeping track of how many lines you read. as you read each line, count how many words there are. (a simple way to do this is to count the number of spaces separating the words. n spaces suggests that there are n 1 words on the line assuming no doubled spaces.