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.

at default you can get OPEN dialog...

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

JFileChooser.showSaveDialog(this);

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


add reputation point if it is helpful to you

Edited 6 Years Ago by musthafa.aj: n/a

Thanks guys.

I found the solution.

Lets assume the name of the JFilechooser is fc.

fc.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG);

^ will make it a save dialog

fileChooser.setDialogType(javax.swing.JFileChooser.OPEN_DIALOG);

^ will make it an open dialog.

Thanks for the advice. +++REP!

This question has already been answered. Start a new discussion instead.