java - CountDownLatch leads to disappearance of content in JFrame (JButtons, etc.) and comes back only when mouse overed -
I am working on a deal or no deal with a user interface. My first problem is that I continue to wait for a button action, and I used the countdown and it worked perfectly. But whenever I click on a button, everything disappears in my Jeframe and when you come up with a mouse, when I press another button, then suddenly it looks again (it never happened) Was that I used the Letes below, and it also happens with Samphorus, etc.) I will try to keep my code as relevant as possible.
public countdown to CDL = new MozillaLap (1); PickFirst (); Try {Cdl.await (); } Hold (Exception e) {} While (Banker. Findcas Left ()> 2) {Banker = New Banker (Mainf. value); For (i = mattersisposic; i> = 1; i--) {cdl = new countdownlock (1); PickCase (); Chosen = false; Try {Cdl.await (); } Hold (exception e) {}}
^^^ This was my class, which works with selective cases below which is the category containing the action list
< Pre> public zero verb (action event ae) {if (! Main.me.pickedFirst) {Main.me.pickedCase = caseNo; Main.f.log + = "You chose to keep the case" + caseNo + ". \ N"; SetText (case number + "\ np"); Main.f.changeLog (); Main.me.pickedFirst = true; Main.me.cdl.countDown (); } Else {int value = main.me.values [caseNo-1]; Main.me.values [caseNo] = 0; Main.f.values [getIndex (value)] setSelected (true). Main.f.log + = "You have been selected to get rid of the case" + caseNo + ". There is $" + value + "in it. \ N"; Main.f.changeLog (); Main.me.picked = true; Main.me.cdl.countDown (); } SetEnabled (false);
Note that awaiting ()
method " Waiting for the current thread awaits until the latch is counted zero. "If it is a thread, the GUI update will be blocked until the waiting condition changes. In general, the countdown louches allow different threads to be matched; This incident should not be used within the Dispatch thread. This complete, which coordinates many
swingwalker
examples, can help clarify the usage.
Comments
Post a Comment