Start 2 Threads by clicking 1 JButton

I want to change 2 JPanels in a CardLayout before the Action of this JButton is performed.
I tried to add a second ActionListener for this Button but both ActionListener used the same Thread so there was no visual effect :(
What am I to do to fix this problem?

First of all thank you for your help.
I already tried to start a second thread:
     public class showWait extends Thread {
          CardLayout textLayout;          
          public showWait(CardLayout tL)
               textLayout=tL;
          public void run()
               textLayout.show(textContainer,"STANDBY");
          public CardLayout getLayout()
               return textLayout;
public void actionPerformed(ActionEvent evt) {
     showWait sw = new showWait(textLayout);
     sw.run();
     textLayout=sw.getLayout();
myCalculation();
textLayout.show(textContainer,"HTML");
But it doesn't work :(
The change of the CardLayout in the showWait thread is not displayed.
Should I declare the Calculation as an other class extends Thread?
That would not be easy because I would have to clone many objects.
Jörn

Similar Messages

  • Painting a rectangle after clicking a JButton?

    Hi all,
    I'm developing an applet that when a button is clicked, a rectangle is painted over an image. The problem is that when I add the painting code in the mouseClicked() method, using Graphics2D.createGraphics(), etc., run the applet and click the button, nothing happens. So, how can I paint a rectangle over an image by clicking a JButton?
    Perhaps something like JPanel.validate(), I don't know...
    Any help would be appreciated.
    Thanks in advance.

    http://forum.java.sun.com/thread.jsp?forum=54&thread=529542&start=5

  • The application was unable to start correctly (0xc0000142). Click OK to close the application. error: 0x6740090A-0x20003

    Hello,
    I have installed the app-v 5 client on a 2012 rd server. After publishing the application I’m getting the error “The
    application was unable to start correctly (0xc0000142). Click OK to close the application.”
    The registry value
    NtfsDisable8dot3NameCreation is already set on 2.
    The error in the eventlog is
     “could not be started because the App-V Subsystem 'Virtual Filesystem' could not be initialized. {error: 0x6740090A-0x20003}”
    Thanks in advance
    Rene

    See this blog post: http://blogs.technet.com/b/gladiatormsft/archive/2013/06/11/app-v-5-0-on-these-0xc0000142-errors-and-where-they-are-coming-from.aspx
    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually
    answer your question). This can be beneficial to other community members reading the thread.
    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.
    Twitter:
    @stealthpuppy | Blog:
    stealthpuppy.com |
    The Definitive Guide to Delivering Microsoft Office with App-V

  • The application was unable to start correctly (0xc00000fd). Click OK to close the application.

    Trying to move Acrobat 7.0 Standard (Version 7.0.9) to a new computer.  found the website to download a new copy of the application.  Downloaded and installed.  When trying to start the application an error message immediately pops up - "The application was unable to start correctly (0xc00000fd). Click OK to close the application."
    How can this be resolved?

    Hi mpatterson54,
    Could you please tell me what OS version are you using on your new computer?
    Regards,
    Anubha

  • "The Application was unable to start correctly (0xc000007b). Click OK to close the application" error when starting Visual Studio Community

    Hi,
    I just installed Visual Studio and when I launch it, the following error pops up: "The Application was unable to start correctly (0xc000007b). Click OK to close the application". I tried searching online but no usable results. Please help!
    jd

    Hi,
    There is not enough information about the problem. For troubleshooting, I recommend you can use Process Monitor to detect whether there's any process failed.
    You can download Process Monitor and see how to use it for troubleshooting in below links:
    http://support.microsoft.com/kb/939896
    http://blogs.technet.com/b/askperf/archive/2007/06/01/troubleshooting-with-process-monitor.aspx
    There are a lot of log entries in Process Monitor, you may filter Visual Studio process only(proces = devenv.exe). And you can upload the logs to OneDrive so that we can investigate them.
    Also, you can refer to Gfazil's post in 
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/96035692-9a50-40d4-a7d3-48bda87d11ec/the-application-was-unable-to-start-correctly-0xc000007b-click-ok-to-close-the-application-when?forum=vssetup
    Please try the method he mentioned to see whether the problem can occur:
    " Replacing the dlls mentioned below from a machine that is working solves the problem:
    c:\Windows\SysWOW64\msvcp100.dll
    c:\Windows\SysWOW64\msvcp100d.dll
    c:\Windows\SysWOW64\msvcr100.dll
    c:\Windows\SysWOW64\msvcr100_clr0400.dll
    c:\Windows\SysWOW64\msvcr100d.dll "
    Best Wishes!
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
    href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

  • The application was unable to start correctly (0x0000906). Click OK to close the application

    Hello People
    I am receiving the error "The application was unable to start correctly (0x0000906). Click OK to close the application" in a couple of Windows 7 Computers, one 64bits one 32bits.
    I have searched the web with no specific solution, so I am requesting help here.
    Thanks in advance.
    Best regards
    Fernando Puntel
    IT support
    [email protected]
    [email protected]

    Hi
    I believe you need to add more detail about this issue
    Can you help me to check at event viewer log maybe we can find cause for this issue
    http://windows.microsoft.com/en-us/windows/what-information-event-logs-event-viewer#1TC=windows-7
    May I know when this issue start happen? any change software or hardware before this issue happen?

  • The application was unable to start correctly (0x000007b). Click OK to close the application.

    the application was unable to start correctly (0x000007b). Click OK to close the application. This is Problem Dreamweaver CC open.

    You'll need to provide more details.
    Is this a new installation of CC?
    Have you ever been able to launch it?
    Which operating system are you using?
    Does your computer meet the min-requirements to run DW CC?
    CC Tech Specs - http://www.adobe.com/products/creativecloud/tech-specs.html
    Nancy O.

  • WINWORD.EXE -Application Error The application was unable to start correctly (0xc0000142). Click ok to close the application

    HI 
    when i am trying to open MSWord following message pop up and i can't open MSword any more:
    WINWORD.EXE -Application Error The application was unable to start correctly (0xc0000142). Click ok to close the application.
    Please advise 

    Hi,
    Does Word start in Safe Mode?
    Press Win key + R, type "winword.exe /safe" in the blank box, press Enter.
    If Word can start in Safe Mode, the issue should be related to 3rd-party add-ins, disable the suspicious add-ins to determine which one caused the problem.
    You can also try repairing Office from Control Panel -> Programs and Features, check if this helps.
    Regards,
    Melon Chen
    TechNet Community Support

  • CMD.EXE: The application was unable to start correctly (0xc0000142). Click OK to close the application.

    Hi. I am running Windows 8.1.
    I recent have been having trouble running cmd.exe. I am getting this pop up message everytime I run the program, whether as a regular user or as Admin. The message that pops up is:
    The application was unable to start correctly (0xc0000142). Click OK to close the application. 
    Can you please help?
    I ran event viewer and this is the report of the error:
    Log Name: System Source: Application Popup Date: 12/22/2013 3:56:10 PM Event ID: 26 Task Category: None Level: Information Keywords: User: SYSTEM Computer: Jason-Vaio Description: Application popup: cmd.exe - Application Error : The application was unable to start correctly (0xc0000142). Click OK to close the application. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Application Popup" Guid="{47BFA2B7-BD54-4FAC-B70B-29021084CA8F}" /> <EventID>26</EventID> <Version>0</Version> <Level>4</Level> <Task>0</Task> <Opcode>0</Opcode> <Keywords>0x8000000000000000</Keywords> <TimeCreated SystemTime="2013-12-22T19:56:10.126735000Z" /> <EventRecordID>493149</EventRecordID> <Correlation /> <Execution ProcessID="760" ThreadID="312" /> <Channel>System</Channel> <Computer>Jason-Vaio</Computer> <Security UserID="S-1-5-18" /> </System> <EventData> <Data Name="Caption">cmd.exe - Application Error</Data> <Data Name="Message">The application was unable to start correctly (0xc0000142). Click OK to close the application. </Data> </EventData> </Event>

    Hello,
    See this blog-post;
    http://blogs.technet.com/b/gladiatormsft/archive/2013/06/11/app-v-5-0-on-these-0xc0000142-errors-and-where-they-are-coming-from.aspx
    Nicke Källén | The Knack| Twitter:
    @Znackattack

  • How to start two threads at the same time

    Hi there,
      I want to include multithreading in the CVI program. I have two tasks which has no dependence between them, so I would like to start two threads for perform the tasks. I follow the introduction http://www.ni.com/white-paper/3663/en/ to start my code. In my code, I add a command button, when it is pressed, I create two threads to perform the tasks. In each task, I have a big loop and in each iteration, I use ProcessSystemEvents to avoid no response on system message. But it doesn't work actually, the program suspended. I wonder must I initialize the threads in main. I am looking for a way to start the threads in the callback function for a button since I am not starting those threads at the beginning but while it is triggered.
    the main frame of the code looks
    int CVICALLBACK Test1(void *functionData)
    { int i=0;
    for (i = 0; i<100000; i++) {ProcessSystemEvents();}
    return 0;
    int CVICALLBACK Test2(void *functionData)
    int i = 0;
    for (i = 0; i<100000; i++) {ProcessSystemEvents();}
    return 0;
    int CVICALLBACK cmdcb(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    { int threadID1, threadID2;
    if (event==EVENT_COMMIT)
    SetPanelAttribute(panelHandle, ATTR_DIMMED, 1);
    CmtScheduleThreadPoolFunction(DEFAULT_THREAD_POOL_HANDLE, Test1, NULL, &threadID1);
    CmtScheduleThreadPoolFunction(DEFAULT_THREAD_POOL_HANDLE, Test2, NULL, &threadID2);
    CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, threadID1, 0);
    CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, threadID2, 0);
    return 0;
    Attachments:
    TestThread.zip ‏239 KB

    In my opinion your threads may be simply lasting longer than expected due to an incorrect sleep policy of threads paired with with ProcessSystemEvents () in the loop.
    I made up a quick example that shows this behaviour: playing with "Do not sleep" and "Call ProcessSystemEvents" options you can see how threads execute.
    BTW: do not forget to release the thread function IDs at the end of functions.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?
    Attachments:
    thread.zip ‏7 KB

  • Why won't OS X Mavericks start downloading when I click the download button? It thinks and acts like it starts downloading with the thinking circle moving then stops and goes away. I have tried going to the purchases in the app store and restarting it the

    Why won't OS X Mavericks start downloading when I click the download button? It thinks and acts like it starts downloading with the thinking circle moving then stops and goes away. I have tried going to the purchases in the app store and restarting it there and that is not working either.

    Repair permissions, restart your computer & try again. 

  • When I try to start a mail by clicking on an adress on an homepage, it dosnot work. Something wrong in my installation? Best regards, Lars-Eri

    When I try to start a mail by clicking on an adress on an homepage, it dosnot work. Something wrong in my installation? Best regards, Lars-Eri

    You mean when you try to click a link that begins with mailto: ? If so, what exactly happens when you click on such an email link? And do you have an email client installed?

  • Starting a thread from a modem message

    I would like to start a thread that parses an incoming text message from a GSM modem when the message arrives. Ideally the arrival of the message should trigger the process to start... Anyone got any tips on triggering the start of a thread from a modem event and/or how to read incoming data directly from a modem?
    Just some initial pointers to the right kind of classes would be great to prevent me chasing down too many blind alleys...
    Dave

    Hi David,
    Are you able to do what you intended to do ??. If so can you shed some light to me ??. I have a similar requirement same as like you had.
    thanks,
    ---sen.

  • Firefox was working and now ir will not Start. When I click on the Icon nothing happans.

    I have been using Firefoz for several months. It will not start now. I click on the icon and nothing happens. I'm running Windows 7.

    Did you reinstall from backups, or www.Mozilla.org?

  • Starting new threads from within shutdown hooks

    I'd like to discuss this statement from the java 6 API:
    "A shutdown hook is simply an initialized but unstarted thread. When the virtual machine begins its shutdown sequence it will start all registered shutdown hooks in some unspecified order and let them run concurrently. *When all the hooks have finished it will then run all uninvoked finalizers if finalization-on-exit has been enabled. Finally, the virtual machine will halt*. Note that daemon threads will continue to run during the shutdown sequence, as will non-daemon threads if shutdown was initiated by invoking the exit method. "
    Now, my question is this: If I have a hook that starts a new non-daemon thread and then goes on to complete it's run() method, will the JVM finalize and halt? Or will it wait for my new thread to complete as well?
    I trust the specification, and believe that the JVM will either not allow me to create the thread or will finalize and shutdown even if it is running. However it's not explicitly stated anywhere, and I think that it's a hole in the documentation.
    I'm going to write a test case for this now. But chime in if you have thoughts.

    This is what happens if you start a new thread from a shutdown hook and do not wait for it to finish:
    public class ShutdownTest {
        private static class Shutdownhook extends Thread{
            public void run() {
                System.out.println("Shutdownhook starting");
                Thread t = new Thread(){
                    public void run(){
                        System.out.println("Thread successfully started");
                        try{ Thread.sleep(5000); }
                        catch(Throwable e){ System.out.println("Throwable from sleep: "+e); }
                        System.out.println("Thread successfully finished");
                t.start();
                //try {t.join();} catch (InterruptedException e) {}
                System.out.println("Shutdownhook completing");
        public static void main(String[] args) {
            Runtime.getRuntime().addShutdownHook(new Shutdownhook());
            System.out.println("Exiting from main()");
            Runtime.getRuntime().exit(0);
    Exiting from main()
    Shutdownhook starting
    Shutdownhook completing
    Thread successfully startedHowever, as you might expect, if you join() or wait for the thread's isAlive() to return false, you will be able to complete the thread.
    I'll leave someone else to figure out if that new thread gets finalized and if finalizers on exit is on, what happens. Mostly because it doesn't matter for my purposes.
    Enjoy

Maybe you are looking for

  • Error while passing parameter(quoted string parameter ) to sql script

    Hi all, I have a master script insert_attribute_single.sql which takes 6 parameter. when i am using in sql prompt SQL>@@INSERT_ATTRIBUTE_SINGLE.SQL 'LEED PROJECT START DATE' 7 'N' 27265185 '7'22'008' NULL; then it is giving error for the 5th paramete

  • Need to delete Itunes and re install it. Will i loose all my music library?

    I accidentally deleted Quick time. It is needed to run itunes. A message tells me to uninstall Itunes and re install it again. My concern is : will i loose all my music library in process? Here's some additional info : WinXP Ipod Classic (5th gen) An

  • How move main class to script in timeline

    hi , in some component they use main class to load various as files and when i see properties of my document i see the name of this class right down the Script : Action Script 3 whe i click on the pen ( edit ) of this class i see various codes about

  • Enter/return key no go in safari

    i created a client login on my page: http://www.reelherofilms.com/ if you enter the password: test and hit the return key on your keyboard it doesn't work in safari, only works if you hit the screen button "enter" it seems to work with both in firefo

  • Web services wizard hangs

    Hi, I am trying to create a stub/skeleton for an external wsdl file. I click the next button and the tool just hangs. Eventually it comes back with "cannot locate wsdl file". I have tried with proxy turned on and off but I get the same result. Howeve