How to use Swing Worker

Hello,
I have an exe file which is to be called from my program and it runs as seperate thread. The main purpose of this exe file is to create two files within the application directory. Next my program check to see if these files exists if these file exists then the program display that the files have been created to the user..
Now my problems
The part of program which checks to see if the exe has created the file should runs in while loop as a seperate thread.
The part of program which displays that the file is being generated should also runs as another thread.
Please any body could code/pseudo-code the above for me, I would really be thank full and appreciate. I have tried to do the above, but in vain because some times the GUI interface does not get updated or some times the file does get created and the program loops forever.
Please help
Josh

I just use SwingUtilities.invokeLater(..). Something like:
SwingUtilities.invokeLater(new Runnable()
     public void run()
          someTextField.setText("some new text");
});

Similar Messages

  • I just want to go back to how it /used/ to work

    Itunes 7 has been a total bust.
    I've lost tv shows that I downloaded when the machine locked up on the 'processing file' stage (that took emails to allow me to enable again). It's taking forever to download 30min shows that used to download quicker than it'd take to watch the previous show (Daily Show and Colbert report) I've got crackly sound, jerky video, all on a machine that used to play the downloads fine.
    I use Itunes for the TVshows moreso than the music, but until they get this truly terrible version of Itunes working, I'll e investigating if I can stop the purchase of season passes until it works.
    I bought them knowing I can download and play them fine. Mid-season pass, the video's are doubled in size and causeing me problems to the level that I don't think it's worth me using this anymore.
    If there was an option on the size of download, then that might be viable. If I could restrict the amount of downloads at one time, that perhaps could help. If it just worked the same way that it used to, then I'd be perfectly happy (as the new front end looks pretty enough, it's the back end of actually PLAYING the content that's broken).
    But as it is, I'm having a VERY BAD experience with this Itunes7.
    How defeat could be snatched from the jaws of victory like this is beyond belief.
    For the reference, there's nothing else running on the machine, it's uptodate with drivers/patches/antivirus disabled. Maybe it's the processor being 1.5Ghz, but my point is that all the downloads USED to work perfectly fine, but now I have no choice and they've broken something that worked. I didn't ask for doubling of sizes and more hardware requirements. (though trying it on another, much faster machine (duo2 2ghz, 2gb ram, still exhibits troublesome behaviour.
    So, I've read that there IS a workaround to get back to the old version, but I'm aghast that we need to do fairly techy things just to make our content play. What happened to Apple? Just works? Not even close.
    /rant off
    (yes, I'm very, very annoyed by this whole incident)

    I think my confusion was seeing multiple Old Firefox Data folders within the same folder. You could try this:
    Open your ''current'' Firefox profile folder using
    Help > Troubleshooting Information > "Show Folder" button
    In the address bar of that window, click '''Profiles''' to move up a level to its parent folder. You should see your current profile folder there, and possibly others.
    Leaving that window open, switch back to Firefox and Exit
    Copy your ''old'' profile folder from your Old Firefox Data folder (possibly the one that ends with .default?) into the normal Profiles folder alongside your current profile.
    Click in the address bar of the window showing your Profiles folder, and copy the path.
    Start up Firefox's Profile Manager using Start > search box (or Run):
    firefox.exe -P
    (Any time you want to switch profiles, exit Firefox and return to this dialog. )
    Click the Create Profile button, then when you get the option to choose a folder, open that up, paste the Profiles folder location, and select the folder you copied in. After finishing creating your "new" profile, start Firefox in that profile.
    Is your old profile restored as you remember it?
    Sometimes all this moving around of files can create issues, and if you were having problems before due to your reset, they will be back, but I think this is the fastest way to return to what you had before.

  • How to use commit work in class cl_bls

    Hi,
    When i have used commit work after email sent,
    it goes into dump.
    Here is the code segment:
      try.
        -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
        -------- create and set document -------------------------------
          pdf_content = cl_document_bcs=>xstring_to_solix( pdf_tab ).
          document = cl_document_bcs=>create_document(
                i_type    = 'PDF'
                i_hex     = pdf_content
                i_length  = bytecount
                i_subject = sub ).  "#EC NOTEXT
        add document object to send request
          send_request->set_document( document ).
        --------- add recipient (e-mail address) -----------------------
        create recipient object
          recipient = cl_cam_address_bcs=>create_internet_address( recip-recip ).
        add recipient object to send request
          send_request->add_recipient( recipient ).
        ---------- send document ---------------------------------------
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
         commit work.
          if sent_to_all is initial.
            message i500(sbcoms) with recip.
          else.
            message s022(so).
          endif.
      ------------ exception handling ----------------------------------
      replace this rudimentary exception handling with your own one !!!
        catch cx_bcs into bcs_exception.
          message i865(so) with bcs_exception->error_type.
      endtry.
    What could be the reason?
    Is there any way to use commit work in class while sending email as in SO_NEW_DOCUMENT_ATT_SEND_API1 fm?
    Thanks.

    Hi,
    I have used
    submit program.....
    but in update task i have used it.
    "Z_SD_ORDER_UPDATE".    program is a print driver program.
    However error says:
    There is probably an error in the program
    "Z_SD_ORDER_UPDATE".  
    This program is triggered in the update task. There, the
    following ABAP/4 statements are not allowed:
    -  CALL SCREEN
    -  CALL DIALOG
    -  CALL TRANSACTION
    -  SUBMIT
    I used submit as:
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                      WITH output = ' '
                    AND RETURN.
    Instead of submit i want to use commit work but i also get a dump after commit work too.
    How can i use commit work in above code?
    Thanks.

  • How to use Swing html to parse a html file..

    I am currently working on a project in java.i need to read a Html file, extract the table tag along with its contents if it has a button embedded in it and replace it with another code..
    i tried it with Reg Ex in java but in vain.. Any help is great... I need an idea of how to use Html parser for this prob.. any examples will be fine..

    Run the program from command line, this way you will see the errors, if any.
    example.: java -jar theJarfile.jar
    I was successful in creating a comm application. I placed the win32com.dll in the same directory of my application jar file and all worked.
    I also extracted the comm.jar , and jar'd my app with the extracted comm files to make one jar.
    I also had a fileWriter() to get the clients jre path and my app would write the javax.properties file to the correct place.
    It took me severel weeks and late nights to accomplish this, but it was all necessary to be able to install only my app, and not a bunch of api's that were needed.

  • How to use Swing in a web Application

    Can you suggest me some good PDF/tutorial or some good site for reading about using SWING in a Web Application.
    In our web application we plan to use JSP/Struts for the presentation layer. However there are a few screens that require some advanced UI like color coded assets and a graphical version of Outstanding Vs Available limit. We are wondering whether we should use SWING for these screens. Do you think this is a good idea or is there a better apprach to deal with this
    What are the disadvantages of using SWING VS JSP/Servlet in a Web environment. Is there a site or pdf where i can get information about this.

    I'd say the biggest disadvantage is that your client machines have to download and install the bloody java plug in.
    What you write about your UI ain't half vague. What the deuce is a "color coded asset"? Is it
    interactive? If not, could it be represented by an image? If so, even if it is a non-static image, it is a simple
    matter for your webapp to generate the image on the fly. Many web app tutorials demonstrate that.

  • How to use Swing in a Web applicatrion

    Can you suggest me some good PDF or some good site for reading about using SWING in a Web Application.
    In our web application we plan to use JSP/Struts for the presentation layer. However there are a few screens that require some advanced UI like color coded assets and a graphical version of Outstanding Vs Available limit. We are wondering whether we should use SWING for these screens. Do you think this is a good idea or is there a better apprach to deal with this
    What are the disadvantages of using SWING VS JSP/Servlet in a Web environment. Is there a site or pdf where i can get information about this.

    Applet/HTML page combinations are used often when a portion of a page requires Swing/AWT capabilities, e.g. administration consoles for Weblogic and JBoss are designed this way. The page is typically divided with frames that contain either applet or HTML code.
    A

  • How to use Swing in Web Applications

    Can you suggest me some good PDF or some good site for reading about using SWING in a Web Application.
    In our web application we plan to use JSP/Struts for the presentation layer. However there are a few screens that require some advanced UI like color coded assets and a graphical version of Outstanding Vs Available limit. We are wondering whether we should use SWING for these screens. Do you think this is a good idea or is there a better apprach to deal with this
    What are the disadvantages of using SWING VS JSP/Servlet in a Web environment. Is there a site or pdf where i can get information about this.

    As mentioned above, you could simply use an Applet, but I would discourage that approach.
    Although it's harder to have a good UI on the web, it's definitely possible (witness Gmail). You can do all sorts of clever things like building collapsible/expandable tree structures on the web with a little Javascript/CSS.
    Swing is much, much slower than regular HTML elements and the API for some Swing things is needlessly complicated (i.e. JTree).
    Could you be a bit more specific about the UI elements that you need? If you wanted to do something like Photoshop, well, it would be almost impossible on the web (to do it well at least), but many other applications are very do-able.

  • How to use swing 3d to do a menu list ?

    Is anyone know any good webpage to show some simples about swing 3d ? I want to do a menu which is using swing 3d . Thank you .
    regards
    jojo

    I've never mixed swing and Java3D but I've got the following URL in my bookmarks. Maybe it will help you.
    http://www.jroller.com/page/gfx/?anchor=a_swing_button_with_3d
    Bye!

  • How to use a Work Repository when type is set to 'Execution' ?

    Hi All,
    I was just trying my hand at importing and exporting work repositories , I need to know how we can use a certain work repository when its type is set to 'Execution'
    I want to import some packages (which are in some other Work repository ) into that Work repository but I am missing something somewhere.
    Can somebody tell me what are the exact steps to import packages or Entire Work Repository into this newly created 'Execution' type Repository ??
    Regards.

    Hi,
    An work repository which is of EXECUTION type cant be used to import packages/interfaces etc.
    You can able to import only SCENARIOS in Operator component (from scenarios tab) and "just" execute it. As the term execution repository stands, u can able to execute objects created in Development repository.
    Moreover, u cant access designer itself if its a EXECUTION repository.
    Thanks,
    Guru

  • How to use a work manager dedicated for an URI

    Hello,
    I have a servlet able to manage different use cases, based on differents URI (the servlet is mapped on /*, and depending of the URI and the configuration, I do different work)
    I would like to set a workmanager on each of my use cases.
    Is it possible to set a workmanager on a use case without any update of the descriptor files ? (without multi mapping the servlet because my use cases are pluggables)
    I've seen it is possible to acces a workmanager programaticaly (commonJ work managers) but it seems to be mandatory to reference the commonJ work manager inside the web.xml file to allow loca JNDI lookup on this work manager. Thus If I add a work manager, I have to update the web.xml. There is another possibility without updating any deployment descriptors ?
    Thank you very much for your answers,
    Best Regards,
    C.

    James,
    thank you for your update.
    1) Concerning the first solution (CommonJ WM), it sounds good for my needs but I still have to update the web.xml to add the resource-ref to access the WorkManager by JNDI:
    <resource-ref>
        <res-ref-name>wm/TestWorkManager</res-ref-name>
        <res-type>commonj.work.WorkManager</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>So I have to update my ear, it is not exactly what I want :(
    2) Concerning the deployment plans, it is also a good idea, I can multiinstance a servlet to use different mapping and then apply different workmanager for different uris,
    This is working. I update the web.xml using a deployment plan.
    The only negative point is I can't only apply the deployment plan but I have to redeploy the entire application (wich is not recommended for production because it occurs a out of service period)
    Do you know any solutions for this two points ?
    Thank you a lot
    Best regards,
    C.

  • How to use Claris works 2 in Lion?

    Apple sales assured me that I could use and/or convert Claris works 2 files into Lion on the latest Macbook pro lap-top. Not so! Any tips?
    I have two types of document - word processed and drawn
    Ludicrous of Rickmansworth

    It's not possible. ClarisWorks (any version, even AppleWorks) requires PowerPC code to run. Earlier versions of Mac OS X included Rosetta, which is a code framework which allowed such applications to run on Intel-based Macs. Lion does not include, and cannot use, Rosetta.
    Apple's Pages application ($20 in the Mac App Store) can read AppleWorks 6 word processing documents. But it can't read any proprietary ClarisWorks documents or older versions of AppleWorks documents.
    Your best bet is to use your old computer to use ClarisWorks 2, open each of your word processing files, and convert/save them into a fairly universal format such as Rich Text Format (.rtf) or maybe something like Word 97. Some formatting may be lost using this procedure.
    If you want to preserve 100% of your formatting, and you have the most recent version of AppleWorks, that can open your ClarisWorks 2 word processing files, which you could then save in AppleWorks 6 format, which then could be opened by Pages. Again though, AppleWorks will not run under Lion so this would have to be done from your old computer.
    GraphicConverter ($40 in the Mac App Store) can read any graphic format I've ever thrown at it, including ClarisWorks files (I've never tried anything from v2 specifically) and PaperPort (an old proprietary format used for document scanning). Or again, you could use your old computer to use ClarisWorks 2 to resave each drawing file in a more universal format such as JPG or GIF.
    I'm sorry I don't have a simpler and easier solution for you, and that you were misled by the Apple sales folk.

  • How to Use Swing-ADF in a Three-Tier-Archiitecture

    I am currently avaluating Swing-ADF (11g) and I wonder how I can leverage it in a three-tier, rich-thin-client-environment. When I bind a control, normally I would do it directly to the database. As I want to have my business logic and database access on the middle-tier, how do I bind my controls to the middle-tier which in turn accesses the database. Does ADF support a mechanism to bind the Swing-Client to the middle-tier-data? Is the recommended way to go for webservices? Can Webservices easily bound to the ADF-controls? Is it the only way?
    best regards
    Stefan

    Stefan,
    It is a built-in feature of ADF Business Components to expose an application module as a stateful EJB session bean to support three-tier Swing-client access. It requires absolutely no effort from the developer, who can even easily switch between running/testing in 2-tier or 3-tier modes. Shay's answer is valid for the general case, but in the specific case of what the ADF tech stack can bring to bear to solve your problem, it can be completely simple to achieve (even requiring zero code, if you choose to leverage that feature of ADFBC).

  • How to use Swing Components in  JavaFX

    Hi All,
    I am new to JavaFx. I am trying to use java swing components in javafx.
    I found a sample program in net and tried it. But it shows compile time error.
    Code:
    MySwingComponent .fx
    import javafx.ext.swing.SwingComponent;
    import javax.swing.JComponent;
    import javax.swing.JButton;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    * @author nandha
    class MySwingComponent extends SwingComponent{
    var button: JButton;
    public var text: String on replace {
    button.setText(text);
    public var action: function();
    override protected function createJComponent () : JComponent {
    button = new JButton();
    button.addActionListener(ActionListener {
    public override function actionPerformed(e:ActionEvent){
    action();
    return button;
    The above code shows no error.
    Test SwingButton.fx
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import swingcomponents.MySwingButton;
    * @author nandha
    Stage {
    title: "Swing Button Example"
    scene: Scene {
    width: 250
    height: 80
    content: [
    MySwingButton{  // error message: imcompatible type. found MySwingButton. Required javafx.scene.Node[]
    text: "Click Me!"
    action: function(){
    println("Hello World!");
    This code which used the MySwingButton shows error: imcompatible type. found MySwingButton. Required javafx.scene.Node[] - where i have added the MySwingButton.
    Please help me to fix the error.
    Thanks &Regards,
    Nandha K

    Hi Sasa,
    First thanks for your reply.
    I found the problem and have fixed.
    Problem:
    There is no class MySwingButton in the package swingcomponents. Its MySwingComponent that i should have used, which is a big mistake that i have done. To my surprise i don't know NetBeans didn't show any error message at that line.
    Thanks & Regards,
    Nandha K

  • How to use commit work as per the requirement?

    Hi all,
           Here i have a requirement about database table updation. I have to update a database table, at the time of doing commit work it has to check the following condition .
    The data should be split up in different groups or records of no more than 2000 after which a commit to the database is executed.
    So can anybody help me in this regard with a piece of code? and i want to know during updation how to lock the data base table and how to unlock? Is there any standard function modules to call regarding this locking and unlocking?
    Thanks & Regards
    Naidu

    which table is that? and do you have any code so far?
    Logically you need to loop thru your records, lock the table for that record, update the table , unlock the tabel record, count the entires so far, andi f it is 2000 issue commit work.

  • Anybody know how to use jave work with mapping file? help!

    mapping file are somehow those...
    <db-insert root-element>
    .....<map-info>
    something like that, and I dont know how java code can use with them..my database is mysql...
    or any reference site is good.?
    Thank you very much

    urm...thanks..
    my job is about to write a transformation tool to transform XML documents into a database. The tools is written for users to extract data in XML format and store it into a database. But i would choose MYSQL. Mapping files are used to store information correctly into database to avoid the need to write new code for each type of XML files. And can choose any programing langugage for implementation such as Java and C#.........and currently still looking on Java or VB

Maybe you are looking for