views:

353

answers:

4

hii every one I want to show progress bar while my program sends email

how can i do it?

+1  A: 

Display a simple gif image with hourglass or striped loading bar or something similar. Since this will be a single step operation you can't actually tell the user N % complete. Add a callback with timeout to verify the success of the operation. How you display the image depends on what technology you are using.

saugata
Not necessarily a single step (connect to server, authenticate, send message). Thunderbird shows a progress bar for this. At least with longish attachments, it actually makes sense.
Thilo
it means i ve to use threads?
Hussain
A: 

depending on native/webapp, single email/multiple emails, solutions might be slightly different.

e.g webapp+single email, consider a animated gif, while you do send the email in another iframe.

e.g. webapp+multiple email, a progress bar can continuously display the percentage done, based on a number of sent emails/total emails, after each email get sent.

mangokun
updated question: it's not a webapp, it's a Swing applet
Thilo
sry i didnt understand .. can u explain me in detail
Hussain
+1  A: 

Swing's JProgressBar is probably your best bet for an applet.

It has a mode for when you don't know how long an operation will take.

For JavaMail you can listen to the transport system (probably com.sun.mail.smtp.SMTPTransport) with a TransportListener which will tell you when each message has been sent at least, so you can do progress for multiple recipients.

Tom
but how to get the progress information out of JavaMail?
Thilo
Up with the lid. Javamail is open source.
Thorbjørn Ravn Andersen
+1  A: 

You need to put together two classes, JProgressBar for the UI, and SwingWorker for the background thread. From your comments, it looks like you first need to be looking at a SwingWorker tutorial.

Yishai