I want to an upload programming in one button of my swing interface.Can any one tell me where I can find examples of upload in swing .
posted 13 years ago
I don't know of any examples on the net, but I can tell you what you need: 1. a JFileChooser, so the user can specify what file to upload (if that is not clear, yet). 2. you should read about multithreading - now that you know which file where to put, you should open a background thread so that the ui does not freeze. (in fact you will need two threads: a workerthread and a controlling thread (which can open a progress monitor (see JProgressBar etc.), for example). There is a class SwingWorker provided by sun (not in the JDK! - Swing Tutorial), it might help you. I don't use it, I found my own way through the threading stuff. 3. if you are not familiar with io in java, you should read about that, as well. (the java tutorial is a good start.) 4. I suppose "upload" means to transfer the file over the network to the server - thus you will need compression (java.util.zip) and networking (java.net). (same here: Java Tutorial) hope this was of any help Chantal [ November 29, 2002: Message edited by: Chantal Ackermann ]