Hussain
Hussain

Reputation: 917

how can i show progress bar while sending an email in java

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

how can i do it?

Upvotes: 0

Views: 2627

Answers (4)

Yishai
Yishai

Reputation: 91881

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.

Upvotes: 1

Tom
Tom

Reputation: 44821

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.

Upvotes: 1

mangokun
mangokun

Reputation: 5613

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.

Upvotes: 0

saugata
saugata

Reputation: 2863

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.

Upvotes: 1

Related Questions