I have a Jframe with 3 textFields and a button, when I press the button the program stores the value of the textFields in Strings and checks them against a pattern, here is the relevant part of the code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Pattern pat = null;
Matcher mat = null;
String file = jTextField3.getText();
pat = Pattern.compile("[a-zA-Z0-9]{1,8}");
if(file.contains(".")){
String [] splitFile= file.split(".");
String fileName = splitFile[0];
mat = pat.matcher(fileName);
}
else{
mat = pat.matcher(file);
}
}
I get an ArrayIndexOutOfBounds : 0 on String fileName = splitFile[0]
, the name of the jTextField is correct and the field is not empty, I tried with 'test.txt' when I got this exception
Thanks for your help