I am trying to scan through text files and add them to a map, the map and everything is working. However, the scanner seems to be stopping when it comes to a 'enter' in the text file, or a blank line. This is my problem
here is my block of code for the scanner/mapper
class OneButtonListener implements ActionListener
{
@Override
public void actionPerformed(ActionEvent evt)
{
final JFileChooser oneFC = new JFileChooser();
oneFC.showOpenDialog(AnalysisFrame.this);
String newLine = null;
oneFC.getName(null);
int returnVal = 0;
File fileOne = oneFC.getSelectedFile();
Scanner input = null;
try {
input = new Scanner(fileOne);
}
catch (FileNotFoundException ex) {
Logger.getLogger(AnalysisFrame.class.getName()).log(Level.SEVERE, null,
ex);
}
inputText = input.nextLine();
String[] words = inputText.split("[ \n\t\r,.;:!?(){}]");
for(int i = 0; i < words.length; i++){
key = words[i].toLowerCase();
if (words[i].length() > 1){
if (mapOne.get(key) == null){
mapOne.put(key, 1);
}
else {
value1 = mapOne.get(key).intValue();
value1++;
apOne.put(key, value1);
}
}
}
}
}
Thanks for any help!