0

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.

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by P00dle
2

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 by musthafa.aj: n/a

0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.