Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser open and cancel button

 
Piyush Pattanayak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey !!

I am developing a database project in which i need to import and export my database, for this i am using Jfilechooser to save and load, but while using the jfilechhoser i found the open and cancel button as non-editable.
How could i write the code for save and cancel button so that the given file will be saved.

thanks in advance
piyush
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

What do you mean by "non-editable" buttons? Buttons are meant to click on, not to edit them.

The JFileChooser is just for selecting files or directories, not for reading or writing anything. You need to implement that in your code.
 
Piyush Pattanayak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i understand my friend but tell me what code should i write so that after clicking the open button the file will be selected.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code examples can be found here, particularly e887 and e890.
 
Piyush Pattanayak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks friend i got my answer, thanks a lot for your help.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you subclass JFileChooser and override approveSelection and cancelSelection you can modify the behaviour. I've done that to be able to show an overwrite dialog before the chooser closes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!