Progress Bar in Java

Hi,
I'm new here, i need to create a Progress Bar for my application,
but i just don't get how to get back how much that a process has proceed,
can anyone help me? i have stuck at here for a few days
example; i do a System.out.Println("blablabla")
how to see it's done or how many percent have been done?
or anyone can give me a good example of Java Progress Bar?
Any help will be very appriciated.

By using this method
public boolean saveAs(Shell shell) {
          FileDialog saveDialog = new FileDialog(shell, SWT.SAVE);
          saveDialog.setFilterExtensions(new String[] { "*.xsd;", "*.*" });
          saveDialog.setFilterNames(new String[] {
                    "XML Schema Definition (*.xsd)", "All Files " });
          saveDialog.open();
          String name = saveDialog.getFileName();
          if (name.equals(""))
               return false;
          if (name.indexOf(".xsd") != name.length() - 4) {
               name += ".xsd";
          File file = new File(saveDialog.getFilterPath(), name);
          if (file.exists()) {
               MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES
                         | SWT.NO);
               box.setText("Save As");
               box.setMessage("File " + file.getName() + " is already exits "
                         + "\n" + "Do you want to replace it?");
               if (box.open() != SWT.YES) {
                    return false;
          this.file = file;
          this.saveToPath = saveDialog.getFilterPath();
          return save(shell);
     public boolean save(Shell shell) {
          if (file == null)
               return saveAs(shell);
          Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
          shell.setCursor(waitCursor);
          FileWriter fileWriter = null;
          try {
               fileWriter = new FileWriter(file.getAbsolutePath(), false);
               fileWriter.write(text.getText());
          } catch (FileNotFoundException e) {
               displayError("File_not_found " + file.getName(), shell);
               return false;
          } catch (IOException e) {
               displayError("IO_error_write" + "\n" + file.getName(), shell);
               return false;
          } finally {
               shell.setCursor(null);
               waitCursor.dispose();
               if (fileWriter != null) {
                    try {
                         fileWriter.close();
                    } catch (IOException e) {
                         displayError("IO_error_close" + "\n" + file.getName(),
                                   shell);
                         return false;
          return true;
     }

Similar Messages

  • 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.

  • 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

  • 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.

  • Progress bars in JTable, is it possible?

    Hello. We are currently making an applet giving the user the progress information of his/her downloads. I need to use JTable for this because each client can download/upload more than one file at the same time.
    We are targetting an interface similar to Kazaa wherein a progress bar is visible on the row of the downloading item. Therefore, I need to incorporate a small progress bar in a cell in the JTable. Is this possible? How?
    I hope someone could help me out on this. I am very new to Swing and Applets (I used mostly JSP with my programs).
    Many thanks in advance. =)

    How to use Progress Bars:
    http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html

  • Threaded Progress bar wont restart

    I know that if i have a progress bar on a form and i wont it to increment on a button click, i must thread it so i did this
    the Main class is "class Form" with variables
    public static JProgressBar progress;
    ThreadedProgress threadbar = new ThreadedProgress();
    public void actionPerformed(ActionEvent e)
    if (e.getActionCommand() == "Submit")
    threadbar.start();
    in the same file i made the a theard to increment the progress bar
    class ThreadedProgress extends Thread
         int num = 0;
         ThreadedProgress()
              //setDaemon(true);
    public void run ()
    num = 0;
    Form.progress.setValue(0); // progress bar in "class Form"
    while (num <1001)
    Form.progress.setValue(num);
    try
    Thread.sleep(10);
    catch (InterruptedException e)
         JOptionPane.showMessageDialog(null,e);
    num += 10;
    if(num > 1001)
    JOptionPane.showMessageDialog(null,"MessageSent");           
    When i click the "Submit" button once to increment the progress bar with the thread it works fine but when i click it a 2nd time, nothing happens...

    Probably the easiest thing to do is to make an anonymous inner Thread class that is within your actionPerformed(ActionEvent e) method. This was a new Thread class could be made each time the button is clicked.
    I gather that from your code, after a message has been sent, you want to show progress for a second. With Java 1.4 - it is possible to put the progress bar in indeterminate mode:
    progressBar.setIndeterminate(true);  // starts progress bar animation
    progressBar.setIndeterminate(false); // stops progress bar animationhttp://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
    When you start sending your message, you could start the animation, and stop animation when the message is sent. You can reuse this method numerous time, as Java makes the required threads, etc. internally.
    Good Luck!

  • Java : 1.5.0 progress bar stops at 100%

    when uploading a file the progress bar reaches 100% but the fails to show the applet. theres a response saying waitng for answer, but doesnt answer.????
    any ideas to this problems. i have tried lookg in FAQs but havent found anyhing reltaing to this particular issue

    i have tried lookg in
    FAQs but havent found anyhing reltaing to this
    particular issueThen it is most probably an issue with your code and since we don't have access to it it is difficult to help.

  • How to show progress bar in miniplayer?

    How to show progress bar in miniplayer? I play a lot of music podcasts and it would be very helpful if anyone could help me bring that feature back.

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

  • Progress bar in forms-10g???

    hi there....can I use a Progress bar in forms-10g??? Previously I've been using an OCX for progress bar. But as forms-10g dont support ocx so is there any replacement in form of java bean, pjc or anything else???
    2ndly can I open my browser window running my forms application in Full Screen mode anyway?

    Dear....Demo for progress bar on Oracle site shows only the code which we should write in a procedure and behind a push button to start and run progress bar. But what is n where is that progress bar in actual? is it a text field or what? is there no sample fmb of this progress bar like that of Timer Bean and autocompletion combo box???

  • Splash screen with progress bar and multiple jar files to load

    Hello,
    I have been looking to the new features in java 6 for splash screens. I haven't implemented this never before and i was wondering how i could do the following with java 1.5 or 6:
    I would like to see a splash screen with a progress bar that "grows" when every jar file has been read.
    At this time i call my application like this from a shell script:
    exec "$JAVA_BIN" -Djava.library.path=$LIBRARIES_J3D -classpath xxxx.jar yyyy.jar zzzz.jar ...
    where xxx.jar, yyy.jar and zzz.jar are very heavy jars.
    So i would like to see in the progress bar 33% 66% and 100% when they are loaded.
    I do not know if this is the right forum to ask for this. If no, please point me which would be the ideal one.
    Any help will be very useful. Thanks to all!

    Am 10.07.2015 um 07:17 schrieb Lalit Solanki:
    > Hi friend,
    >
    > I am create pure eclipse E4 application and trying to splash screen with progress bar and message.
    >
    >
    >
    >
    > but above image in only support eclipse E3 application so pleas help me how to add progress bar and message in eclipse E4 application
    >
    Hi Lalit,
    there's a Bug entry: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382224
    Meanwhile you can use this solution:
    https://www.eclipse.org/forums/index.php/t/328812/5ceed4bcaa683a94d65efb161bffd217/
    Regards,
    Ralf.

  • Error while running progress bar

    Hi ,
    I wrote the following code in process form request to get the progress bar.
    if (pageContext.getParameter("submit") != null)
    while(i<20)
    try{
    OAProcessingPage page =
    new OAProcessingPage("xxx.oracle.apps.xxap.apr.webui.testingCO");
    page.setConciseMessage("This is the concise processing page message.");
    page.setDetailedMessage("This is the detailed message which should explain what's happening.");
    page.setProcessName("Wait for some time..");
    pageContext.forwardToProcessingPage(page);}
    catch (OAException E)
    System.out.println("inside catch ");
    pageContext.putDialogMessage(E);
    System.out.println("inside loop ");
    i++;
    it showing clock symbol but the next second it shows the followin error:
    Exception Details.
    oracle.apps.fnd.framework.OAException: java.lang.NullPointerException
         at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:71)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    ## Detail 0 ##
    java.lang.NullPointerException
         at xxhex.oracle.apps.xxrmu.repmig.webui.RepExecuteCO.processFormRequest(RepExecuteCO.java:65)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:71)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    java.lang.NullPointerException
         at xxhex.oracle.apps.xxrmu.repmig.webui.RepExecuteCO.processFormRequest(RepExecuteCO.java:65)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:71)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    iam new to oaf can any one please help me how to resolve it...

    hi ,
    i wrote the following code i got the clock and i moved to the home page again but no operations are performed between these two actions.following is my code.
      public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
        string test="A";
    try{
        if( pageContext.getParameter("submit") != null) 
          OAProcessingPage page =
                              new OAProcessingPage("xxx.oracle.apps.xxap.apr.webui.testingCO");
                      page.setConciseMessage("This is the concise processing page message.");
                      page.setDetailedMessage("This is the detailed message which should explain what's happening.");
                      page.setProcessName("Wait for some time..");  
                      pageContext.forwardToProcessingPage(page);
           test="B";
    System.out.println("testing "+rtest);//this action is not done.. it is not giving any print statement whil running in local system
       catch (OAException E)
               pageContext.putDialogMessage(E);
               pageContext.forwardImmediatelyToForm("OA.jsp?page=/oracle/apps/xxap/apr/webui/TestPG&retainAM=Y");//(forward to calling page with retainAM=Y)
                HashMap hashmap1 = new HashMap(1);
                hashmap1.put("test", "test");
                  if(test!= " "){
                                            System.out.println("test "+test);
                pageContext.setForwardURL("OA.jsp?page=/oracle/apps/xxap/apr/webui/TestPG",
                                          null,
                                          OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                          null,
                                          hashmap1,
                                          true,
                                          OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
                                          OAException.CONFIRMATION);
    test value shows only "A"
    and it is also not giving any confirmation message after moving into same page. please help me on this...

  • Macbook Pro seems to be bricked by ML install. Upon restart it shows a progress bar which makes it to about 15%, and then the machine simply shuts off. Help?

    Title pretty much says it all. Install seemed to be going fine, then upon restart it hit a gray screen with a progress bar for about 30 seconds. Once the progress bar makes it to about 15% the machine simply shut off. I tried turning the machine on again a few times, but each time I had the same issue. I then tried running the 10.8 recovery disk, but it just showed the gray spinning wheel for about 6 hours. Any ideas?

    Something similar issue with me too. Intallation went fine. Then it started updating java once reboot it got stuck on grey screen. It wont boot at all. That spinning wheel keeps on going forever. :(

  • Displaying an Indeterminate Progress Bar While a DB2 Stored Proceedure Runs

    How do I display a dialog with an indeterminate progress bar while a DB2 query runs? Could anyone point me to an example or some strong docs?
    I learned Java about six months ago, so I'm relatively new to the language. Through searching and documentation, I've been able to find all the examples and answers I've needed so far. Now I've run into an issue I can't find anywhere. It seems like the most basic thing in the world. I have a DB2 stored procedure that takes about 5 minutes to run. While it's running, I want to display a simple dialog with a progress bar going back and forth (no buttons, no user interaction).
    I'm using Eclipse 3.3.1.1 as my IDE, and running the application from a JAR file. I have Java 1.6.0.30 installed. The DB2 query is running in response to a user clicking a button on the form (an ActionEvent). All of my forms are using Swing (JFrame, JDialog, etc.).
    The crux of my problem seems to be that I can bring up a dialog (which should contain the progress bar), but I can't get it to paint. All I get is a window that's the right size/location, but contains an after-image of what was behind it. I can't even get a dialog to display with a "Please Wait" label while the DB2 procedure runs.
    I tried separating both the DB2 stored procedure and the progress dialog into separate threads. I tried yielding in the DB2 thread to give the progress dialog a chance to update. I tried using invokeAndWait, but I got the following error:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
    It seems like I'm doing something wrong in my use of Theads, but I can't for the life of me figure out what it is. If anyone could help out a bit of a Java newbie, I would be extremely grateful.

    Demo:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ProgressBarExample2 {
        private JProgressBar bar = new JProgressBar(0,99);
        private JButton button = new JButton("Lengthy operation");
        private ActionListener al = new ActionListener(){
           public void actionPerformed(ActionEvent evt) {
                button.setEnabled(false);
                bar.setIndeterminate(true);
                new Worker().execute();
        private class Worker extends SwingWorker<Boolean, Boolean>{
            protected Boolean doInBackground() {
                try {
                    Thread.sleep(10000); //10 secs
                } catch (InterruptedException e) {
                return Boolean.TRUE;
            protected void done() {
                button.setEnabled(true);
                bar.setIndeterminate(false);
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ProgressBarExample2();
        ProgressBarExample2() {
            button.addActionListener(al);
            JPanel cp = new JPanel();
            cp.add(button);
            cp.add(bar);
            JFrame f = new JFrame("ProgressBarExample2");
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Creating Progress Bar for File Upload

    Hi, I'm trying to implement a progress bar indicator for a file upload in WebDynpro, without very good results.
    I'm using a fileupload UI element, a TimerTrigger and a ProgressIndicator UI elements for this purpose.
    It seems that using the fileupload UI element the iview is locked during the file upload, and therefore it prevents for the timer triggered action to be performed (this action updates the progress bar).
    Additionally I havent been able to capture the transfered bytes from the upload. Maybe I'm using the wrong elements?
    How could I achieve this. Has anyone done it?
    I would really appreciate all the help I could get.
    Homer Vargas

    Hi,
    Can anyone please tell me the way to upload file from client system to server.
    The code i have is as follows:-
    Jsp:-
    function saveImage(){
         //projectname.javafilename
         var strStatus = "save";
         document.saveImageForm.action="/irj/servlet/prt/portal/prtroot/TestXML.TextImageLink?frmstatus="+ strStatus;
         document.saveImageForm.method="post";
         document.saveImageForm.submit();     
    <form name="saveImageForm" encrypt="multipart/form-data">
    <table width="388" cellpadding="1" cellspacing="1" bgcolor="#F0F0F0" border='0'>
           <tr>
                 <td><font color="blue" face="verdana" size="2">IMAGE:</font></td><td><input id="image" type="file" name="image" value=""/></td>
         </tr>
    <tr>
         <td><input type="submit" name="submit" value="Submit" onclick="saveImage();"/></td>
         </tr>
    </table>
    </form>
    now i am not getting what to write in java file
    using IPortalComponentRequest.
    Using the jsp file upload in tomcat is working but here it is not working
    please help meee
    Thanks in Advance
    Regards
    Sirisha

  • How to know the debit of dowloading in ftp to use it in the progress bar

    hello
    i have a class that download file from the server , and another class (progress bar)
    i dont know how i can get the debit of downloading with(ftp jave) to use it in the progress bar
    if so have an idea or have used the progress bar in ftp getting file please help help
    i really dont know what to do
    please hhhhhhhhhhheeeeeeellllpppp
    thanks

    i have a class that download file from the serverI take it you didn't write said class yourself. Does it have a published API you could point us at?

Maybe you are looking for

  • K9N Platinum Problem

    Hello, I have a K9N Platinum 7250-020 and I read from a different forum to make a new thread about the shutdown issues since it said it wasn't affected. Funny thing is, I'm getting the same exact problem. My specs: CPU: AM2 4200+ (2.4ghz, memory is n

  • Can anyone explain this? ORA-01722

    Hi all, Can anyone understand this? I have 3 database servers both running on windows 2000 advanced server, they're used by the development team. Also we have our production database. The 3 databases are cloned from the production, so database config

  • Aggregates based on Nav Attribute Hierarchy

    Hi, I have naviational attribute hierarchy based on created by and enabled as navigation attribute from Infocube. So for each transaction the created by pulls up the corresponding nav attribute from master data. I have enabled the Created By nav attr

  • Timesheets in Microsoft Project Server 2010

    Our team is starting this year using timesheets for collecting actual work from all of our vendors.  I am having a problem seeing the actual work in project professional once the time has been entered into PWA, processed and approved.  Would someone

  • How to call MFC Dll Dialog

    Hi, I have created a MFC regular dialog as a dll(TestDialog). And exposed the entire class. Did not expose any specific member function. Then i created one more MFC dialog based exe and trying to call my dll. I did the below settings: Input: TestDial