How to use progressbar with another process ?

Hi guys, i am working on an audio processing project in which i want to implement progressbar.I have two separate classes in which one contains code for GUI and another contains code for the logic when some event occurs in GUI.
I have process button whose click event does the processing of files and attach tags to it.
The processing of files does in another class. I have tried using the progressbar with GUI when user clicks process
it should co-relate with appropriate message like "(Processing 1 of 10 files) " and side by side progress also been shown and when all tags attached to the files completed then it should give finished message on progressbar.
public javax.swing.JProgressBar progressBar;
public TAG{
progressBar = new javax.swing.JProgressBar();
progressBar.setName("progressBar");
this.progressBar.setString("Awaiting User Input");
this.progressBar.setStringPainted(true);
private void processBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_processBtnActionPerformed
        // TODO add your handling code here:
        AudioTagProcessor audioTagProcessor = new AudioTagProcessor();
        FileHelper fh=new FileHelper();
        int mp3Files = fh.getFiles(new File(sourceTxt.getText()), AVLConstants.FILE_TYPE_MP3);
        //setJProgressBar1(jProgressBar1);
        if(mp3Files>0){
            setProgressBarToDisplay(mp3Files);
            processBtn.setEnabled(false);
            timer.start();
            try{
                FileUtils.copyDirectoryToDirectory(new File(sourceTxt.getText()), new File(destnTxt.getText()));
               audioTagProcessor.searchForTags(new File(sourceTxt.getText()), new File(destnTxt.getText()), AVLConstants.FILE_TYPE_MP3, this,progressBar);
                progressBar.setString("Finished Processing "+mp3Files+" of "+mp3Files+" files.");
                addToActivityLog("Processed " + mp3Files + " files of " +AVLConstants.FILE_TYPE_MP3+ " type.");
            }catch(Exception ie){
                ie.printStackTrace();
        }else{
            addToActivityLog("Selected 'Source Folder' does not contain any files of type " + AVLConstants.FILE_TYPE_MP3
                    + ". Please Selected a folder containing files of type "  + AVLConstants.FILE_TYPE_MP3);
        }The addToActivityLog is a text pane where i used to display message.
The AudioTagProcessor is a class where i used to do tag attachment to mp3 file.
The problem comes is that whn i click process button it completes all the tag attachment process and then the progressbar starts and displays message. Is there any way so that i can relate both the processes with each other like when tag is being attached side by side progressbar also increases and give me appropriate message.
Can u plz help me how to do that ?

DarrylBurke wrote:
sureshot324 wrote:
Yeah read the link. Basically how it works is you launch another thread that does the heavy work and updates a variable (usually an int, or define your own Progress class that includes a status message) that keeps track of the progress. You then launch a Timer that checks this variable at a certain interval, say every 200 miliseconds, and updates the progress bar accordingly.Looks like you're not familiar with the JDK 1.6 SwingWorker, with its doInBackground, publish and process methods :-)
dbNope I'll have to look into it. Does it really make it much easier than my method though?

Similar Messages

  • How can I use Bluetooth with another devices?

    How can I use Bluetooth with another devices?

    You can set up your FaceTime account in Settings > FaceTime.

  • Somebody Knows how to use Roambi with Excel spreadsheet? I leed the process. Thanks

    Somebody Knows how to use Roambi with Excel spreadsheet? I leed the process for my IPAd

    I don't even know what it is, but have you explored the support available from the developer?  http://www.roambi.com/iphone-videos.html

  • Microsoft sql client deadlocked on lock resources with another process

    Hi
    I wrote a forecasting report for a customer which creates an excel spreadsheet with the information
    Depending on how they run the report it can take between 5 to 15 minutes to run
    We have just upgraded the customer to SAP 8.8 PL10 and Microsoft SQL Server 2008 and they seem to be getting an error -
    Microsoft sql client deadlocked on lock resources with another process .......
    The error seems intermittent, they may get the error once and the next time they run it, it is fine.
    I have never seen this error before and they never had it before on SAP 2005
    Can anyone suggest anything please?
    Thanks
    Regards Andy

    Hi Andy,
    I was having the same problem. I'm gonna tell you what i did.
    My query usually takes from 10 to 15 minutes to show results. That long time also block all transaction in the database.
    I was reading about some techniques to improve queries performance. Some of the tips are:
    1. Review indexes in the table you are querying
    2. Use Views
    3. Avoid cursors
    4. Archive old data
    5. Use the correct transaction isolation level
    The last one, was the tip that helped me to avoid the block in the database.
    By default the isolation level in SQL Server is Read Commited, that explains why the database block some transactions. For example, if you have a query that take data from JDT1 table and it takes several minutes to show the results, other transactions that try to write in the same table should be blocked if they arrive at the same time of the first query.
    To solve this, you can make your query in a transaction with Snapshot isolation level. It means that your select query will take a snapshot of the data without blocking any other transaction.
    Here is an example how you can make it. The difference is that you may use ADO.NET connection replacing DI API Connection:
    oConnection = OK1.Generic.Helpers.setConnection(server, password, userID, db); // You have to set anyway your sqlconnection
                        if (oConnection.State == ConnectionState.Open)
                            oCommand = new SqlCommand();
                            oCommand.Connection = oConnection;
                            oCommand.CommandTimeout = System.Convert.ToInt32(timeOut);
                            oCommand.CommandText = "ALTER DATABASE " + db + " SET ALLOW_SNAPSHOT_ISOLATION ON";
                            oCommand.ExecuteNonQuery();
                            sqlTran1 = oConnection.BeginTransaction(IsolationLevel.Snapshot);
                            oCommand.CommandText = query;
                            oCommand.Transaction = sqlTran1;
                            oCommand.ExecuteNonQuery();
                            sqlTran1.Commit();
                            oCommand.CommandText = "ALTER DATABASE " + db + " SET ALLOW_SNAPSHOT_ISOLATION OFF";
                            oCommand.ExecuteNonQuery();
                            if (oConnection.State == ConnectionState.Open)
                                oConnection.Close();
    In this example I write the data to show in the report in other table, then the report takes the data from that table.
    I hope it will be helpful for you.
    Regards,
    Juan Camilo

  • How to use Terminal with KeySpan USB serial adaptor cable?

    I own a KeySpan model USA-19HS to use with our MacBookPro when working on clients networking equipment that require serial communication. I have used ZTerm with excellent luck, but it costs, and is yet another application that I dont really want. I would like to know if any one out there has exacing instructions on how to use Terminal with this adaptor. If I could write a file that had, say, the couple most common settings (9600-8-n-1, 57600-8-n-1, et cetera) that I could simply click on, to open a new Terminal window with those settings, then simply close that, and open a new window (apple+n) in order to get back to a default settings terminal window. All feedback is most appreciated.
    Thanks so much, Jason Sjobeck

    Hi, Jason. Welcome to the Discussions.
    You wrote: "All feedback is most appreciated."OK.
    1. Have you considered discussing this with Keyspan Support?
    2. Have you read the section "OSX has Terminal.app - why do I need ZTerm?" on the ZTerm Home Page? That seems to explain why one needs an app like ZTerm.
    3. A quick search of Keyspan's FAQ for your product and terminal doesn't yield much more than how to find the serial ports using Terminal.
    Likewise, this Google search also yields little, and variants of that search of such weren't particularly help either.
    It appears your inquiry seems to be a somewhat esoteric topic.
    4. Apparently, ZTerm X is a bit long in the tooth and there's no Universal Binary for it. It sounds, however, like you've tried it running on your MBP under Rosetta, yes?
    5. In researching alternatives to ZTerm for you, I note the followng:• The comment from "Reverb" on this page suggests C-Kermit or Kermit as a free alternative.
    • This tip on Mac OS X Hints cites Minicom as another option.6. You may want to try your question on the Unix Discussion.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • How to use variables with

    I need to get the number of lines in internal table, which would
    be easy, using DESCRIBE TABLE itab LINES lines. But the problem
    is, that I get the name of this internal table in the field of
    another internal table, so I have to use the name of internal
    table as variable, but I don't know how to use variables with
    DESCRIBE TABLE (or if this is possible).

    Hi,
    REPORT ZPRUEBA782 .
    define two tables with diferent structures.
    data: begin of table1 occurs 0,
    registro type i,
    end of table1.
    data: begin of table2 occurs 0,
    registro type i,
    repid like sy-repid,
    end of table2.
    data: rows type i.
    start-of-selection.
    fill them with data
    do 1000 times.
    table1-registro = sy-tabix.
    append table1.
    enddo.
    do 1757 times.
    table2-registro = sy-tabix.
    table2-repid = sy-repid.
    append table2.
    enddo.
    call a form that receives as input the table and returns the number
    of rows as output.
    perform howmanyrows tables table2 changing rows.
    break-point. "evaluate the number of rows
    perform howmanyrows tables table1 changing rows.
    break-point. "evaluate the number of rows
    end-of-selection.
    form howmanyrows tables itable changing rows.
    rows = 0.
    loop at itable.
    add 1 to rows.
    endloop.
    endform.
    You can try it if you don't find a better solution.
    Cheers,
    Chaitanya.

  • How to use BAPI with Decision Dialogue

    Hi Gurus
    would you please let me know how to use BAPI with decision dialogue in guided procedure .
    I have a BAPI checking logon credentials for the user . how to use this BAPI for making decisions that is if the logon is correct then perform one process else go to logon screen again .
    Thanks in advance
    Regards Namita

    Hi Namita,
    1. Follow the steps mentioned in section <a href="http://help.sap.com/saphelp_crm50/helpdata/en/33/198141f906040de10000000a1550b0/frameset.htm">Exposing an RFC-Enabled Function Module as a Callable Object</a> to use the BAPI as a Callable Object.
    2. Follow the steps mentioned in tutorial # 93 and 93a in the CAF Tutorial Center for the decision part.
    Hope these helps.
    Nilay

  • How to use buttons in hcm process and forms?

    Hi Experts,
    I want to know how to use buttons in HCM process and form.
    And when i click on the button it was validating all the fields and it was throwing an error ( complete SACHP fields) i am not using this filed in any where of my form.
    So, please help in getting out of this error. And help me with some document, which method will  trigger once we click on the button.
    Thanks & Regards,
    Rocky

    You do not need to add this field to your list. In the view V_T588MFPROPS (SAP delivered), this field is set as mandatory. In configuration, you must maintain the view V_T588MFPROPC (Customer area) and make sure the field is not set to mandatory. This will override the SAP delivered setting and the error message will be not be displayed.
    Derrick Banks
    Banks & Company, LLC

  • Javascript error on - Help - Learn how to use Numbers with this online...

    I am trying to find out more about Numbers. I am using iTunes 9.1.1 on a Vista PC. I get a Javascript error in Internet Explorer 8 when I try to access:
    Help - Learn how to use Numbers with this online resource.
    http://help.apple.com/numbers/1.0
    The link redirects to the following page:
    http://help.apple.com/iwork/safari/interface/#tan727163ed
    The above page is blank except for boxes for Keynote Help, Pages Help, Numbers help, and a blank input field that seems to do nothing. Here is the Javascript error message from Internet Explorer 8:
    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
    Timestamp: Tue, 1 Jun 2010 20:55:54 UTC
    Message: This command is not supported.
    Line: 1
    Char: 41589
    Code: 0
    URI: http://help.apple.com/iwork/safari/interface/javascript.js

    Link also does not work for me in WIN 7 with IE8. However, it does work in Chrome in WIN 7. It also works in Safari on my G4. Suggest you try Chrome or it may work in another browser like FireFox or Safari in Vista.

  • How to Use Gmail With Apple's Mail?

    Answer:
    Now Itis not a Problem, Please go to this link and know how to solve this problem, Ihave configuir this in my mac pro. Have enjoy.
    http://picturemuseum.blogspot.com/2011/08/how-to-use-gmail-with-apple-mail.html
    http://mobilesuggestion.blogspot.com/2011/08/how-to-use-gmail-with-apples-mail.h tml

    I notice that it's possible to have sticky posts in these forums. See
    http://forum.java.sun.com/forum.jspa?forumID=534
    the Concurrency forum for an example. Posting a link to the FAQ in a sticky post might reduce the number of FAQs asked here by maybe 1%? Or posts like this one might do well as a sticky?

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

  • How to use javap with jar files ?

    how to use javap with jar files ?
    thanks

    As long as the jar is on the class path, your gold. So,
    javap -classpath myjar.jar mypackage.MyClass
    Chuck

  • What is correlation ? when and how to use it in BPEL process?

    Hi,
    What is correlation ? when and how to use it in BPEL process?
    Thanks

    Hi:
    Take a look at this entry http://blog.andrade.inf.br/2010/03/oracle-bpel-11g-correlation-sets.html
    thx
    best

  • Help me!! How to use JavaScript with JSP ??

    I am using JDeveloper and I created a screen in JSP which uses a bean for database connectivity and retriving info onto the page.
    The page has a ListBox where list items are populated from the database.My requirement is
    whenever the list is changed the page shuold be refreshed with the selected item info.
    I tried to use 'JavaScript' for triggering the event with 'onChange' event of the ListBox.But the event is not getting invoked. I think JavaScript is not working with JSP.
    Please help me with how to Use javaScript with JSP or any other alternative where I can meet my requirement.
    I have one more question...I have gone through the JSP samples in OTN and I am trying do download the sample 'Travel servlet' which show list of countries...etc
    I have also gone through the 'readme' but I don't know how to extract .jar file.
    I would be great if you could help me in this.
    Thanks!!
    Geeta
    null

    We have a similar need. We have used Cold Fusion to display data from Our Oracle Database. We have a simple SElect Box in HTML populated with the oracle data. When someone selects say the State of Pennsylvania. then we have an On change event that runs a Javascript to go get all the cities in Pennsylvania.
    Proble we are having is that inorder for the Javascript to work , we currently have to send all the valid data.
    Do you know of any way to dynamically query the the Oracle database in Javascript

  • How to use JExamXML with Crimson

    Hello,
    A7Soft JExamXML (http://www.a7soft.com) uses XML parser Xerces. I want to use it with another XML parser.
    (Crimson for instance) Can anybody help me.

    Somebody else had the same question over here:
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=31&t=006906

Maybe you are looking for

  • My editor has stopped working in Photoshop Elements 10!

    I keep getting a "RUNTIME ERROR PROGRAM C:\ PROGRAM FI..." and then it reads THIS APPLICATION HAS REQUESTED THE RUNTIME TO TERMINATE IT IN AN UNUSUAL WAY" everytime I try to access the editor program in Photoshop Elements 10!  Shuts down every time,

  • Issue out despite Expiry Date is over

    Dear all, We have maintained the minimum remaining shelf life as 100 days for the materials . It prompt us to key in the Shelf Life Exp. Date during MIGO but during Good Issue, even though the expiry date is over, the system still allow us to issue o

  • Need to Configure RMAN backup in 8.1.7.4.1

    I have been asked to design a backup and recovery strategy for our production and test databases I got 2003 Enterprise server with 3 disks of each 300gb. There are 10 databases running in versions 8,9,10 with 5 production and 5 UAT database. The sum

  • Apps in memory

    Why even after I close apps, they consume memory (they are present in memory). Even if this is after 1 day of closing app. I understand system apps should always be there, but others like app store, image editor... i would like they to be closed auto

  • Video will not open OS 10.6.8 Safari 5.1.10, youtube page freezes the system. Activity moniy=tor shows all memory being used up, but processor use is very low

    Video will not open. OS 10.6.8, safari 5.1.10. problem is very noticeable when opening youtube main page. stalls complete system. tried reloading most recent version of flash. Activity monitor identifies all memory is being used to open page, no proc