Current post is on how to apply File Filter in Abstract Window Toolkit (AWT) FileDialog component on Windows
Started working on AWT in Java and got stuck in FileFilter FileDialog component?
Unable to get the desired filter in FileDialog on Windows?
Just set the required file filter in setFile function of FileDialog
Because:
In setFileFilter Java documentation it states:
For more details refer to Java documentation on FileDialog
Hope this post saved your time.
Appreciate your feedback via comments.
Thanks.
Mehul
Unable to get the desired filter in FileDialog on Windows?
Just set the required file filter in setFile function of FileDialog
fileDialogObject.setFile(".java");
Because:
In setFileFilter Java documentation it states:
Filename filters do not function in Sun's reference implementation for Microsoft Windows.
FileDialog setFile in Java:
FileDialog fileDialogObject = new FileDialog(parentFrame,"Java Files Selection",FileDialog.LOAD);
fileDialogObject.setFile("*.java");
//It will show all the .java extension files in FileDialog Box
For more details refer to Java documentation on FileDialog
Hope this post saved your time.
Appreciate your feedback via comments.
Thanks.
Mehul
No comments:
Post a Comment