Question: I have been reading up on JFileChooser in javax.swing.\* I know the showOpenDialog() method will allow me to select a File and click 'choose' but I have a specific way I want it to work.

I want to use two JFileChooser's (probably side by side in a JPanel) to select a TO and FROM path and then click a button that will take the user input from both 'Chooser's and do something. 

Perhaps if anyone has an example of just doing a single JFileChooser like this? Essentially just highlighting the file/directory in the chooser and clicking some OTHER button to take the input from the 'Chooser (also the JFileChoosers button's (cancel and choose) are hidden). 

Most likely this 'other' button would just be a signal to the code to get the value from the JFileChooser object.

I'm hoping being new to Swing that there is another class I am missing that can do what I have described but it's just not coming up in Google searches I have been crafting.

Answer: 
This [example](https://stackoverflow.com/a/4054307/230513) extends `JFileChooser` to handle the selections directly by overriding the approve and cancel methods.

```
class MyChooser extends JFileChooser {

    @Override
    public void approveSelection() {
        ...
    }

    @Override
    public void cancelSelection() {
        ...
    }
}

```
Edit: According to @MadProgrammer this is not correct.

`JFileChooser` is a **dialog** which is designed to perform the Open and Save stuff. You can change the name of the button and probably remove the Cancel. But you can't make it open as a Panel.

However, it's a dialog and it'll require a fair bit of reworking to get it embedded in a page instead. The source is available though, so it's possible. You can reuse the `javax.swing.filechooser` classes.