thread-sleep

JavaFX rectangle doesn't update

♀尐吖头ヾ 提交于 2021-02-15 07:33:53
问题 I'm trying to do a maze resolver with a cellular automaton but I have a display problem for each new generation of a grid of an automaton we try to display the cells in the form of rectangle.The initialization works well and the grid is displayed,the last generation of the simulation is displayed too but not the intermediate steps. pic of first generation last generation //Initialise la liste des rectangles public void initRectList() { for(int height = 0; height < this.mazeA.grid.getHeight();

java set delay to change imageicon

一曲冷凌霜 提交于 2021-02-05 12:18:57
问题 i'm trying to set a delay when a button is pressed to set an imageicon to a certain image then set another delay so that another image would be set, all of this by single click. in other word : click a button->set image->delay->set another image. what i get in my code is the last state only "set another image". also i don't want to use use timers, i want to use delays. and here the part in my code i'm concerned about. btnNewButton.addMouseListener(new MouseAdapter() { @Override public void

Thread.sleep (change image) Java

守給你的承諾、 提交于 2021-02-05 07:25:06
问题 I have two jlabels with an image.. I try to change the image in a label when the other is clicked.. (such as a game).. I have a problem..When i write the Thread.sleep the image is not change..See the code: public class Game extends JFrame{ private JLabel l1,l2;; private boolean isClicked = false ,isClicked2 = false; public Game(){ setLayout(new FlowLayout()); l1 = new JLabel(new ImageIcon(getClass().getResource("image1.png"))); add(l1); l2 = new JLabel(new ImageIcon(getClass().getResource(

Problems with my Thread.sleep()

帅比萌擦擦* 提交于 2021-01-28 09:55:48
问题 I'm creating a simple video poker program and right now I'm working on the action that's performed after the user has specified the cards he wants to hold, and replace the discarded cards with new cards after the draw. I have an Action where I want to replace the cards one by one with a delay between all replacements, but with the code I have below, it'll sleep for 500 ms multiplied by the number of cards I have to replace and THEN replace all the cards at once, rather than replace it one at

How to correctly pause/delay Windows Forms application

非 Y 不嫁゛ 提交于 2021-01-27 07:00:24
问题 I am a beginner to the OOP and the C#. I am working on a quiz game using the Windows Forms. My problem is related to two classes, the form and the game logic . I have a basic UI with classic Froms controls. Take a look. The thing I want to achieve is, when a player presses any answer button, it will higlight that pressed button by red or green color, depending on if it is right or wrong answer. After changing the color I want the program to wait for a while and then go to the next question.

InterruptedException not caught on RxJava onError callback? [duplicate]

邮差的信 提交于 2020-05-14 11:23:49
问题 This question already has an answer here : How to handle dispose in RxJava without InterruptedException (1 answer) Closed 5 days ago . I have a simple code below compositeDisposable.add(Observable.create<Int> { Thread.sleep(1000) } .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({}, {Log.d("Track", it.localizedMessage)}, {})) Handler().postDelayed({compositeDisposable.clear()}, 100) It purposely use Thread.sleep(1000) , just to trigger the

when would python stuck at time.sleep function?

吃可爱长大的小学妹 提交于 2020-01-24 20:42:59
问题 Currently, I'm using selenium in python to do something which needs a never-end-up loop to monitor what I want, here's the code snippet: records = set() fileHandle = open('d:/seizeFloorRec.txt', 'a') fileHandle.write('\ncur time: '+time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))+'\n') driver = webdriver.Chrome() while(True): try: print "time: ", time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) subUrls = aMethod(driver) # a irrelevant function which returns a list

when would python stuck at time.sleep function?

大城市里の小女人 提交于 2020-01-24 20:42:20
问题 Currently, I'm using selenium in python to do something which needs a never-end-up loop to monitor what I want, here's the code snippet: records = set() fileHandle = open('d:/seizeFloorRec.txt', 'a') fileHandle.write('\ncur time: '+time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))+'\n') driver = webdriver.Chrome() while(True): try: print "time: ", time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) subUrls = aMethod(driver) # a irrelevant function which returns a list

Jenkins hangs between build and post-build

烂漫一生 提交于 2020-01-24 04:15:48
问题 After updating Jenkins to version 2.156 (from version 1.6), some of our build jobs get stuck after completing and before moving to post-build action. Job itself is finished within 5 minutes (same as before), then it hangs for 5-10 minutes before moving on. I managed to narrow it down to this: "Executor #10 for master : executing 03_masa #4390" Id=34464 Group=main TIMED_WAITING at java.lang.Thread.sleep(Native Method) at hudson.util.ProcessTree$WindowsOSProcess.killSoftly(ProcessTree.java:560)

forceLayout(), requestLayout()

放肆的年华 提交于 2020-01-24 04:04:28
问题 My reading of the android documentation finds the methods forceLayout() (which is to produce a layout display at the next layout request) and requestLayout() (which is supposed to post an immediate layout request), but I can not get them to behave as advertised. In particular, if I do one set text before a Thread.Sleep and one after, it waits for the Sleep to finish before setting both texts at once, whether or I call the forceLayout() and requestLayout() in between. Please do not respond