Hello.
I've built a java application in which the user loads a number of images into the application at run time. The application stores the path to the image. When the application needs the image it constructs a new imageicon with the path specified, when it no longer needs it it deletes it for garbage collector. When the user saves they specify a folder to save in as well as a name to save as, with JFileChooser. My main data object is serialized here with the specified name, + each image in the program is loaded and written to this location as well, with the specified name + an identifier number. When this file is loaded by the program later it will go to these images it has written when it needs them instead of the original images on disk, which may be in various places on the computer.
So when I save my program with name "Balloon" in folder "Rex" Rex will hold Balloon, as well as BalloonImage0, BalloonImage0-1, BalloonImage0-2, etc. But I would rather just have *one* file saved on disk, instead of saving multiple files to a folder. I want people to be able to move the saved document of the program as a single file, and also not to be able to delete an image in the file as they would be able to do now. So I guess I would want the folder "Rex" to look like one file.
Could anybody help me out with how to do this? I am new to java and I'm not even sure if I'm asking this the right way. Thank-you for anybody's reply.
A question regarding saving, file formats....
Page 1 of 13 Replies - 784 Views - Last Post: 15 April 2009 - 05:31 PM
Replies To: A question regarding saving, file formats....
#2
Re: A question regarding saving, file formats....
Posted 13 April 2009 - 02:59 PM
Just have an ImageIcon array in your main class
this array will be saved as the rest of your class
You know that saving ImageIcon to disk may not be re-usable with next version of Swing
this array will be saved as the rest of your class
You know that saving ImageIcon to disk may not be re-usable with next version of Swing
#3
Re: A question regarding saving, file formats....
Posted 14 April 2009 - 07:10 PM
pbl, on 13 Apr, 2009 - 01:59 PM, said:
Just have an ImageIcon array in your main class
this array will be saved as the rest of your class
You know that saving ImageIcon to disk may not be re-usable with next version of Swing
this array will be saved as the rest of your class
You know that saving ImageIcon to disk may not be re-usable with next version of Swing
An imageicon array? Before I had been creating the imageIcons as I needed then but when I tried to save I got a java out of heap memory error. The imageicons weren't in arrays they were properties of objects I created and instantiated, left in the heap. Should I not have gotten that error?
Also I technically have been saving the images as jpgs to disk by creating a bufferedimage and writing on the the bufferedimages graphic, so I have been saving jpgs not imageicons.
Thanks.
Sumner
This post has been edited by NeonKingKong: 14 April 2009 - 07:12 PM
#4
Re: A question regarding saving, file formats....
Posted 15 April 2009 - 05:31 PM
Page 1 of 1

New Topic/Question
Reply



MultiQuote



|