views:

62

answers:

2

I'm creating a basic program (in Java) for a class that helps students study using flashcards, notes, etc. I need a way to allow the user to upload a certain image or video into my program so that it will be available even after they quit and relaunch.

I'm thinking of something along the lines of writeObject and readObject and creating "image" and "video" objects.

Can someone provide some advice about this? It would be much appreciated. I have very limited experience with GUI, so I'm having trouble getting started.

+1  A: 

I find your problem description a little confusing... but if by "uploading" the image or video, you mean an existing file that your program would become aware of (since you are talking about GUI programming,), then you can use a FileChooser, and to save the file locations for next time the program is used you could use the Preferences API.

And concerning copying files from one location to another, see this SO thread which explains how to do it using the nio package or with the Apache Commons library.

JRL
Thanks for your quick response.I am thinking along the lines of this situation, for example: A user has a photo stored in "Documents/Pictures" and I want to go ahead and make a copy of the image, and store this copy in my program's own directory, so that if the user decides to delete their "Documents/Pictures" folder, it will not affect my program.
Christopher James
+1  A: 

Using the swing framework, use JFileChooser to help you upload files (including video and images).

you can use Jimi for image io, and here's an example of a simple video player in java

Just create a folder somewhere and store the uploaded videos and videos there, then display and play them using an image or video framework like the ones above. Make that your default directory and just open it up each time your program loads up.

Charles Ma
Thanks for your input. The part that I'm having trouble with is "and store the uploaded videos and images there". I will have a look at all of your links and feel that I can probably figure it out from there. Thanks!
Christopher James