I do not do GUI programming in Java. However, I have a simple class that I run all the time (it simply spits output to System.out) but it works on different files.
I want to implement the ability to choose a file from the file system.
I found some code on JFileChooser at:
but it won't compile because it requires some parent "Component" object. I think maybe I need to create AWT somehow. But I know nothing about AWT.
So if someone could please show me some code that can open a file from the file system from a regular java class then it would help me a lot.
Actually I would prefer to use the Windows Open File Dialog but I suspect that is more difficult to do. But if you know how to use that instead of JFileChooser then feel free to demonstrate that approach. Otherwise I would be happy to know how JFileChooser works.