How to use a progress bar with java mail?

Hi, i'm new here.
I want if someone can recommend me how to show a progress bar with java mail.
Because, i send a message but the screen freeze, and the progress bar never appear, after the send progress finish.
Thanks

So why would the code we post be any different than the code in the tutorial? Why do you think our code would be easier to understand? The tutorial contains explanations about the code.
Did you download the code and execute it? Did it work? Then customize the code to suit your situation. We can't give you the code because we don't know exactly what you are attempting to do. We don't know how you have changed to demo code so that it no longer works. Its up to you to compare your code with the demo code to see what the difference is.

Similar Messages

  • Is there a way to use a progress bar with Xerces XML Parser?

    My program is parsing very long XML files that take several minutes to parse. I am using Xerces as the parser. I would like to use a progress bar to show the progress, but I haven't found any way to get Xerces to give progress updates. Is this possible?

    Use teh SAX parser and listen to SAX events. Example:
    import java.io.*;
    import java.util.*;
    //jaxp-api.jar:
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    //sax.jar:
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.XMLReader;
    import org.xml.sax.helpers.DefaultHandler;
    import mine.IOUtils;
    * Handler to read content from (large) XML sources and send events to registered XMLListeners. Use this class to read
    * big (multiple megabytes) XML files via SAX and listen to XML events to process XML elements.
    * For small (less than a megabyte) XML files, it's more convenient to use the DOM API
    * to read the XML into a DOM document and perform XPath commands. DOM is easier to handle but has
    * the drawback that the complete XML content is stored in one big DOM document object in memory.
    public final class XMLHandler extends DefaultHandler {
        /** (Reusable) XMLReader to parse an XML document. */
        private XMLReader xmlReader = null;
        /** Registered XMLEventListeners. */
        private List<XMLListener> listeners = new ArrayList<XMLListener>();
        /** Value of current element. */
        private StringBuilder elementValue = null;
        /** Stack of current element and all of its parent elements. */
        private Stack<String> elementStack = new Stack<String>();
         * Constructor.
         * @throws Exception
        public XMLHandler() throws Exception {
            super();
            // Create a JAXP SAXParserFactory and configure it
            final SAXParserFactory spf = SAXParserFactory.newInstance(); //Use the default (non-validating) parser
            spf.setValidating(true);
            // Create a JAXP SAXParser
            final SAXParser saxParser = spf.newSAXParser();
            // Get the encapsulated SAX XMLReader
            xmlReader = saxParser.getXMLReader();
            xmlReader.setContentHandler(this);
            xmlReader.setDTDHandler(this);
            xmlReader.setEntityResolver(this);
            xmlReader.setErrorHandler(this);
        }//XMLHandler()
          * Add XMLListener to receive XML events from the current XML document.
         *  If <i>listener</i> is null, no exception is thrown and no action is performed.
          * @param listener XMLListener to add.
         public void addXMLEventListener(final XMLListener listener) {
            if (listener != null) {
                listeners.add(listener);
        }//addXMLEventListener()
         * Parse current XML document. Registered XMLEventListeners will receive events during parsing.
         * @param fileName Name of file to read XML content from.
         * @throws Exception
        public void parse(final String fileName) throws Exception {
            if (fileName != null) {
                parse(IOUtils.openInputStream(fileName));
        }//readXML()
          * Parse current XML document. Registered XMLEventListeners will receive events during parsing.
         * @param inputStream InputStream to read XML content from.
          * @throws Exception
         public void parse(final InputStream inputStream) throws Exception {
            if (inputStream != null) {
                xmlReader.parse(new InputSource(inputStream));
        }//readXML()
         * Overwrite super.
         * Receive notification of the beginning of the document.
        @Override
        public void startDocument() {
            for (XMLListener l : listeners) {
                l.documentStarted();
        }//startDocument()
         * Overwrites super.
         * Receive notification of the start of an element.
        @Override
        public void startElement(final String uri, final String localName, final String qName, final Attributes atts) {
            elementStack.push(qName);
            for (XMLListener l : listeners) {
                l.elementStarted(qName, elementStack);
            elementValue = new StringBuilder(); //element value
            //element attributes:
            if (atts.getLength() > 0) {
                String attName = null;
                for (int i = 0; i < atts.getLength(); i++) {
                    attName = atts.getQName(i);
                    final String attValue = atts.getValue(i);
                    for (XMLListener l : listeners) {
                        l.attributeRead(qName, attName, attValue);
                }//next attribute
            }//else: no attributes
        }//startElement()
         * Overwrites super.
         * Receive notification of character data inside an element. This method can be called multiple times
         * from SAX, so we need to append all results of all calls to the final element value.
        @Override
        public void characters(final char ch[], final int start, final int length) {
            String s = new String(ch, start, length);
            elementValue.append(s);
        }//characters()
         * Overwrites super.
         * Receive notification of the end of an element.
        @Override
        public void endElement(final String uri, final String localName, final String qName) {
            for (XMLListener l : listeners) {
                l.elementEnded(qName, elementValue.toString());
            elementStack.pop();
        }//endElement()
         * Overwrite super.
         * Receive notification of the end of the document.
        @Override
        public void endDocument() {
            for (XMLListener l : listeners) {
                l.documentEnded();
        }//endDocument()
    }//XMLHandler

  • How to use a progress bar?

    Hello to everyone, i am trying to put a progressbar in my application, the progress bar i use is the one that appears in the Swing Component part of JBuilder, i have the next code:
    JProgressBar progBar=new JProgressBar();
    progBar.setMinimun(10);
    when i compile the code the next error occurs:
    incorrect method declaration; the return type is missing.
    I have looked at the Jbuilder help but the code i find is the same as mine, and in other samples too.

    show some more codes....it willl surely help...i just hope the error didn't originate from the minimum() method because it was misspelled...

  • How To Use Microsoft Progress Bar import in ocx in forms6i

    I import microsoft progress bar in ocx in form6i but i dont have to initialize it
    with form or cursor..
    can any one send sample code on [email protected]
    thanxx

    show some more codes....it willl surely help...i just hope the error didn't originate from the minimum() method because it was misspelled...

  • How to use the Rc4DLL.dll with java (jre1.4 )

    I am not able to use Rc4DLL.dll with java, there are some characters (encrypted using Rc4DLL.dll) that java is not able to identify. So while decrypting in java using Rc4DLL I am not getting the desired output (as some character java tries to decrypt are not supported with java). Could some one give a solution of using Rc4DLL with java jre 1.4

    RC4 cipher is supported by 1.4.
    And surely you can turn a link to the 1.5.0 JCE Reference Guide into a link to the 1.4.2 Reference Guide? I did. Took me 5 seconds to check that. As opposed to wasting a day and a half in forums like you just did.

  • Progress bar with Cancel button

    Hi Gurus,
    How to implement the Progressing bar with Cancel btn using the ScriptUI?, is it possible in script UI ?
    Thanks in advance.
    Regards,
    Imagine

    what i said is that you need to hava a reference to your thread ine the class that handle the progressBar.
    and in your Thread class you create a method like setCanceled(boolean b)...
    public MyThread extends Thread{
       private boolean canceled = false;
       public void setCanceled(boolean b){
          canceled = b;
       public void run(){
          while(!canceled){
            //do your stuff

  • How can I use a progress bar in objective c mac

    How can I use a progress bar in objective c mac? I have a code that downloads a file and I want to be able to let the progress bar increase by 1. A bit further on the code (to download the file) it needs to increase again. And so on...
    My code
    -(IBAction) downloadButtonPressed:(id)sender;{
        //get the path to the image that we're going to download
        NSURL *url = [NSURL URLWithString:@"https://www.dropbox.com/s/l6o07m48npxknt4/Cluedo.zip?dl=1"];
        //get the path to documents folder where we're going to save our image
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *DocumentsDirectory = [paths objectAtIndex:0];
        NSString *filePath = [DocumentsDirectory stringByAppendingPathComponent:@"Cluedo.zip"];
        //Download the file to memory
        NSData *data = [NSData dataWithContentsOfURL:url];
        NSError *error = nil;
        //Save it on the Documents directory
        [data writeToFile:filePath options:NSDataWritingAtomic error:&error];
        NSFileManager* fm = [NSFileManager defaultManager];
        NSString* zipPath = filePath;
        NSString* targetFolder = @"/Applications"; //this it the parent folder
        //where your zip's content
        //goes to (must exist)
        //create a new empty folder (unzipping will fail if any
        //of the payload files already exist at the target location)
        [fm createDirectoryAtPath:targetFolder withIntermediateDirectories:NO
                       attributes:nil error:NULL];
        //now create a unzip-task
        NSArray *arguments = [NSArray arrayWithObject:zipPath];
        NSTask *unzipTask = [[NSTask alloc] init];
        [unzipTask setLaunchPath:@"/usr/bin/unzip"];
        [unzipTask setCurrentDirectoryPath:targetFolder];
        [unzipTask setArguments:arguments];
        [unzipTask launch];
        //[unzipTask waitUntilExit]; //remove this to start the task concurrently

    Your code really isn't suitable for a progress bar, not a real one anyway. Your code will spend about 99.9% of its time in the method "dataWithContentsOfURL:url". That is not a method you want to use in the real world. It is only for demos or proof of concept exercises. All network operations should be asynchronous. That gives you the ability to gracefully recover when there is a failure and also to do fancy things like display a progress bar and tell the user when the download is complete.
    Once you get the asynchronous download logic working, then you can worry about the progress bar. The first thing you will need is the size of the file. Without that, all you can ever do is an indeterminate progress bar or spinner. If you have the size of the file, then you can keep track of how much of the file you have downloaded and update your progress bar with the percentage complete. Make sure to throttle it to no more than incrementing by 1% at a time. Otherwise, a large file or a file transferred in many small chunks, would waste too much time updating the progress bar for no change.

  • How to make use of *progress bar*?

    I have a progress bar requirement in my swings project,
    i.e on clicking a button, some task should be executed and in parallel to this
    progress should run on progress bar in the same frame and soon after this task
    gets completed the progress on progress bar should come to an end.
    How can i do this in swings?
    could any one help me out from this?

    How to use progress bar
    http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
    If you want an example scroll down to the bottom of the page and download the examples.

  • How to show progress bar in java???

    Hey guys!!! can any one tell me how to show the progress bar when a processing is going on???Is it done by multithreading?? I have to import data from database kept in another machine into my database.It would take quite a longer time especially when database is quite large.I want to show the progress and every data being imported to the user so that user does not think that system has hanged on...Please help...

    i answered here:
    http://forum.java.sun.com/thread.jspa?messageID=9739423&#9739423

  • JavaFX progress bar with glow effect.

    I am hoping someone can help me with this issue. I recently followed James Clarke example of a progress bar with glow effect and it helped with developing a progress bar for an application I was working on. But now, with the JavaFX sdk 1.2 update, the application does not fully work anymore. The progressbar.fx code is posted below:
    ProgressBar.fx code:
    import java.lang.Math;
    import java.lang.Object;
    import javafx.animation.Interpolator;
    import javafx.animation.Timeline;
    import javafx.scene.CustomNode;
    import javafx.scene.effect.GaussianBlur;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.paint.Color;
    import javafx.scene.paint.Paint;
    import javafx.scene.Scene;
    import javafx.scene.shape.Ellipse;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    import javafx.scene.text.TextOrigin;
    import javafx.stage.Stage;
    import javafx.scene.layout.Resizable;
    public class ProgressBar extends CustomNode, Resizable{
    public var min: Number;
    public var max: Number = 100.0;
    public var value: Number;
    public var background: Paint = Color.rgb(118,149,178);
    public var foreground: Paint = Color.rgb(216,219,225);
    public var font = bind Font{name: "Courier Bold Italic" size: height - borderWidth * 8};
    public var arcWidth: Number = 20;
    public var arcHeight: Number = 50;
    public var borderStroke: Color = Color.BLACK;
    public var borderWidth: Number = 1;
    public var fontPaint: Paint = Color.LIGHTGRAY;
    public var showPercentage = true;
    var progressText: Text;
    var backgroundText: Text;
    var progessBar: Rectangle;
    var range = bind Math.abs(max - min);
    var percentComplete: Number = bind if(max != 0) { (
    value - min) / max
    } // if
    else {0.0;} // else;
    var currentX = bind percentComplete * width;
    var blurX: Number = 30;
    var progressString: String = bind "%%{%.0f (percentComplete*100)}";
    var progressValue = bind "{%.2f value}";
    var progressHeight = bind height - borderWidth * 4;
    var blurAnim = Timeline {
    repeatCount: Timeline.INDEFINITE
    autoReverse: true
    keyFrames: [
    at(0s) { blurX => 0.0 }
    at(2s) { blurX =>
    currentX - progressHeight / 2 tween Interpolator.EASEBOTH }
    var playing = bind visible on replace{
    if(playing) {
    blurAnim.play();
    }else {
    blurAnim.stop();
    public override function create(): Node {
    return Group {
    content: [
    Rectangle { //background
    width: bind width
    height: bind height
    fill: bind background
    stroke: bind borderStroke
    strokeWidth: bind borderWidth
    arcWidth: bind arcWidth
    arcHeight: bind arcHeight
    cache: true
    backgroundText = Text { // Text over Background
    layoutX: bind (width - backgroundText.layoutBounds.width) / 2
    layoutY: bind (height - backgroundText.layoutBounds.height) / 2
    textOrigin: TextOrigin.TOP
    font: bind font
    fill: bind foreground
    content: bind if(showPercentage) progressString else progressValue
    cache: true
    Group {
    content: [
    progessBar = Rectangle { // Progress
    layoutX: bind borderWidth
    layoutY: bind borderWidth * 2
    width: bind currentX
    height: bind progressHeight
    fill: bind foreground
    arcWidth: bind arcWidth
    arcHeight: bind arcHeight
    Ellipse {
    centerX: bind blurX
    centerY: bind height / 2
    radiusX: bind progressHeight
    radiusY: bind progressHeight / 2
    fill: Color.rgb(255,255,255,.7)
    effect: GaussianBlur{ radius: 30
    Text { // Text Over Progress Bar, this has to be in progressBar coordinate space
    x: bind (width - backgroundText.layoutBounds.width) / 2
    y: bind (height - backgroundText.layoutBounds.height) / 2
    textOrigin: TextOrigin.TOP
    font: bind font
    fill: bind background
    content: bind if(showPercentage) progressString else progressValue
    clip: bind progessBar
    }, // Text
    ] // 2nd content
    } // 2nd Group
    ] // 1st content
    }; // 1st Group
    } // public override function create(): Node
    } // public abstract class ProgressBar extends CustomNode, Resizeable
    function run(args:String[]):Void {
    var stage: Stage = Stage {
         title: "Progress Bar"
    scene: Scene {
    width: 925
    height: 60
    content: ProgressBar {
         layoutX: 10
    layoutY: 10
    width: 890
    height: 35
    value: 80
    } // content: ProgressBar
    } // scene: Scene
    } // var stage: Stage = Stage
    } // function run(args:String[]):Void
    I use RESTful ws to get the progress of the billing run, which is the loadProgressdata() method in the main.fx, and everything was working fine until we did the javafx sdk 1.2 update. With the update in place, I recompiled the project and found that "Resizable" in
    the "public class ProgressBar extends CustomNode, Resizable" was throwing an error when the project was recompiled. I made some changes(mainly adding variables for height and width) but now when the program runs, the backing rectangle appears along with the
    percentage of billing progress, but the progress part(2nd rectangle) does not appear with the glow effect. I have read about using "getPrefWidth()" and "getPrefHeight()" methods, but not really sure how I would use them. I can't make the public class ProgressBar extends CustomNode, Resizable abstract as I need to instantiate in the Main.fx.
    Can anyone shed some light on what might need to be done to get this running correctly again. I don't need anyone the give me the exact code, but just to point me in the correct direction.

    Can you post your code again between "{ code} ... {code }" tags ? Some symbols are missing if copy/pasted.
    That said, your preferred width and height, simply return the width and height of your component. What I discovered recently is using LayoutInfo on controls to set the preferred width and height. These are the dimensions the surrounding container (VBox, HBox, Flow, ....) will use to arrange size and position of the enclosed components. So maybe you won't need Resizable any more. Simply fill in the layoutInfo property.
    Edited by: Java.Artisan on Jun 26, 2009 11:25 AM
    Edited by: Java.Artisan on Jun 26, 2009 11:26 AM

  • How to use JavaMail 1.4 with Oracle Application Server 10g (9.0.4.0.0)

    Hi all,
    I'd like to know if it's possible and how to use JavaMail 1.4 with Oracle Application Server 10g (9.0.4.0.0), Windows version.
    With the following code, I can see that the mail.jar used by the server is the one included in the jdk installation :
    // I'm testing InternetAddress.class because I want to use commons-email-1.2.jar that requires mail.jar 1.4 (or higher) and activation.jar 1.1 (or higher)
    // and I know that inside the commons-email-1.2.jar file, I need to call the InternetAddress.validate() method that throws a java.lang.NoSuchMethodError: javax.mail.internet.InternetAddress.validate()V if it is used with mail.jar 1.2.
    Class cls = javax.mail.internet.InternetAddress.class;
    java.security.ProtectionDomain pDomain = cls.getProtectionDomain();
    java.security.CodeSource cSource = pDomain.getCodeSource();
    java.net.URL location = cSource.getLocation();
    System.out.println(location.toString());
    This code returns : file:/C:/oracle/app/jdk/jre/lib/ext/mail.jar and this mail.jar file has an implementation version number: 1.2
    - I've tried to include my own mail.jar (1.4.2) and activation.jar (1.1.1) files in the war file that I deploy, but it doesn't work (the server still uses the same mail.jar 1.2)
    - I've tried to put the mail.jar (1.4.2) and activation.jar (1.1.1) files in the applib directory of my OC4J instance, but it doesn't work (the server still uses the same mail.jar 1.2)
    - I know that a patch exists : I've read the following document: How to Make Libraries such as mail.jar and activation.jar Swappable ? [ID 552432.1]
    This article talks about the Patch 6514136, but this patch only applies to : Oracle Containers for J2EE - Version: 10.1.3.3.0
    Can you please help me ?
    Thanks in advance for your answers,
    Laurent

    I strongly suggest to upgrade to AS 10.1.3 to get this.
    Think of future support of AS 9.0.4. You will get not critical patch updates anymore.
    --olaf                                                                                                                                                                                                                                                                                                               

  • Is their any tutorials on how to make a navigation bar with drop downs in Dreamweaver CC now ?

    Is their any tutorials on how to make a navigation bar with drop downs in Dreamweaver CC now that they do not have the spry option?

    bbull2005 wrote:
    Preran, why wouldn't Dreamweaver include it's own menu/navigation bar widget?
    I can't answer on Preran's or Adobe's behalf, but I think you'll find at least part of the answer here: http://wiki.jqueryui.com/w/page/38666403/Menubar
    Adobe decided to discontinue development of Spry in August last year, and Dreamweaver CC made the switch to using jQuery UI widgets and effects. One reason for dropping Spry was that it failed to work correctly in some browsers. Judging from the fact that the jQuery UI menubar is now "on ice", creating a flyout menu that works reliably across all devices is proving more difficult than originally envisaged.
    Because all other widgets in Dreamweaver CC use jQuery UI, it's a reasonable assumption that Adobe hoped the jQuery UI menubar would be ready in time, but it wasn't.

  • How to make a scroll Bar with buttons

    Hi all,
    I am using Flash cs6 on an iMAC running 10.7.2
    I would like to know if anyone could please point me to a tutorial, showing "how to create a scroll bar with buttons". I am having a heck of a time finding a tutorial.
    Many thanks in advance.
    regards,
    DH

    http://learnola.com/2008/10/27/flash-tutorial-create-a-custom-scrollbar-with-actionscript/

  • Using GAP math software with Java 1.4, possible?

    Hello all,
    i work at a tech university and a Prof. has the following question:
    Some of his students want to use a free math software package called GAP with their diploma work. Question is: Can they use the GAP package with Java 1.4 Math Class and how does one interact between using GAP and Java 1.4?
    If anyone can help, i would be much obliged.
    Thank you.
    Raymund

    There does not seem to be any such capability, based on the articles in the GAP forum. You might want to look at this article which mentions a means of using Maple and GAP from Java programs.
    http://www.gap-system.org/~gap/Forum/Solomon.1/Andrew.1/JavaMath.1/1.html
    Chuck

  • How to use HTML Tags in webdynpro java

    Hi,
         Can any body tell me how to use HTML Tags in webdynpro java.
    If u provide me with sample code it will become more usefull.
    Thanks & Regards,
    SN

    HI,
    Please find the steps:
    Create a html file and store in your webdynpro project
    Add the html contents in your file
    & Create a IFRAME UI element and refer you html file
    Now you able to see the html in webdynpro
    Thanks & Regards,
    Ram

Maybe you are looking for

  • APPLE customer service for ipod touch

    sorry if this is a bit dragged out post, but i'll limit it to as short as possible. bought my daughter an ipod touch for last christmas which has always been inside a hard case and never been outside and is like new when out of case(for cleaning). la

  • Windows 8.1 hibernation still not working for me properly

    I see that this was already discussed in the past; but for me hibernation on Windows 8.1 still does not always work properly. Link to previous question: http://social.technet.microsoft.com/Forums/windows/en-US/238ec268-a2dc-49ab-8a75-c185710e086a/win

  • Blackberry Torch 9860 won't start

    Type of phone: Blackberry Torch 9860 Problem: I had a software problem, phone got stuck, and after restart it gave a jvm error. I tried to fix it through Blackberry Desktop Manger. During the fix it stopped, and i got a white screen on the phone. Aft

  • EXtraction through function module

    Hello I have craeted generic extractor which is using function module for pulling sales document data.. Here is the code UNCTION ZRSAX_BIW_GET_DATA_SIMPLE. ""Local interface: *"  IMPORTING *"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR *"     V

  • Configure VSS on cisco 4506-E With sup ws-x45-sup8-e

    Hi There, I want to configure VSS on 4506-E with sup card 8 (ws-x45-sup8-e). Currently 4506-E is having 3.3.0.x0 with ROM as 15.1(1r)sg1. I am unable to configure VSS on this, i believe it is not support. Anyone help me on that. Many Thanks