I have this program that reads a video file from my computer and analysis will be done on it.
Right now I can only read the file by changing the directory and the file name in the code.
I want to include a function to select the video file from my computer on my program’s UI, like a toolbar that has browse button to select the correct directory and file that I want and my program will use it, all done on the UI.
Any tips and suggestions implementing this capability?
Oracle has excellent documentation on the JFileChooser swing component that you should have a look at. Example projects are also provided there. The documentation provided is excellent. They provide a basic example of this usage that reads as follows:
Which is enough to display a file picker dialog. Beyond that you should look into making this call from and actionPerformed event, fired either by a JButton or JMenuItem, both of which also have solid documentation provided by Oracle.
I’d also recommend looking into using the Netbeans Swing GUI builder if you are just starting out with Swing, particularly as layouts can become quite complicated to work with at times.