like in title how to make filter to .txt files?
i wrote something like this but it has error :(
private void jMenuItem1ActionPerformed(java.awt.even
You are going wrong here:
int retval = chooser.showOpenDialog(null);
public boolean accept(File directory, String fileName) {`
return fileName.endsWith(".txt");`
}
You first show the file chooser dialog and then apply the filter! This wont work. First apply the filter and then show the dialog:
public boolean accept(File directory, String fileName) {
return fileName.endsWith(".txt");
}
int retval = chooser.showOpenDialog(null);