• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using JFileChooser instead of serialization hard coded files  RSS feed

 
Joe Chavis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using book Head First Java pg 464

Hello all,

I am attempting to use a JFileChooser to save my beatbox data which originally was using a serializable method. I am having trouble grasping how to get a serializable object such as a Boolean that is originally coded to go directly to a hard coded file and turn into something that JFileChooser can save (the user creates the file name vs it being hard coded). Here is an example below:

The working Serialization method:



What I have tried to do with it:


Thanks in advance for any help!
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit rusty on this, but I think you should just be using JFileChooser to get the user to specify a File object. Once you have the File, you just use that in place of the hard-coded filename string. It doesn't have anything to do with serialization per se.
 
Joe Chavis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luigi Plinge wrote:I'm a bit rusty on this, but I think you should just be using JFileChooser to get the user to specify a File object. Once you have the File, you just use that in place of the hard-coded filename string. It doesn't have anything to do with serialization per se.


AH never thought of that. I was too busy trying to change the data to be saved instead of just changing from where the data is saved. Excellent turn around time and I thank you! Here's my resolution for future coders with a similar issue:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!