I need help with jFilechooser.

I've already made the jFilechooser. The problem is that I want to change the text of the "save" butten to "Ok", as I need it to perform a save function, as well as a read function, on different occasions.

Changing the code where the jFilechooser is instantiated is not an option, since the whole thing is done with Netbeans's GUI editor, so the code for the jFilechooser is not editable.

Any assistance would be greatly appreciated.

Have you looked the API for JFileChooser?

at default you can get OPEN dialog...

if you want SAVE button then you call code below...


put if else condition then call corresponding dialogue....

add reputation point if it is helpful to you

Thanks guys.

I found the solution.

Lets assume the name of the JFilechooser is fc.


^ will make it a save dialog


^ will make it an open dialog.

Thanks for the advice. +++REP!