Andrey Mironov

+ Follow
since Jan 09, 2019
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrey Mironov

There is a solution.

The problem was the simultaneous use of the @WithStateMachine annotation and Builder.getMachine(), which contradicted each other.
1 month ago
I wrote the implementation of the state machine, using the Spring guide.

But I can’t achieve any reaction for changing the states, although the states themselves change successfully. Perhaps I misunderstood the goal of the Beans class? I need to achieve automatic execution of the closeDoor() and startMoving() methods when the corresponding state changes.

These messages in the methods on the console are not displayed:



And the launch (the states are displayed correctly in the console, according to the events):

Dependency is only one.

What I'm doing wrong?
1 month ago

Knute Snortum wrote:Platform.runLater() does "run later," but the tasks to run later are put into the queue one after another.  That's why you can have two "run laters" and be guaranteed they will run one after the other.

A solution with two Platform.runLater() really worked. It is a pity that it did not occur to me before.

Thanks for the help!
6 months ago

Knute Snortum wrote:Do you specifically want a certain GIF to show you're task is busy...?

Yep, GIF should run over the program window while the program code is being executed. Like this:

I followed your advice and wrapped 'Platform.runLater (() -> showGif ())' into Runnable. I tried to place it directly in the Event Handler - the result is the same, the GIF runs only after all the main code. Although, logically, it should be launched in parallel - a separate thread is running.

Then I again decided to use my previous approach with the launch in main of an infinite loop that checks the 'isStarted' status of the button. Instead of Task set Runnable. Did not help. Again, first the code - then gif.

How to make them work at the same time?
6 months ago

I apologize in advance for a lot of text, but I come back to this problem the second day and tried several solutions, plus I did not receive a working answer on stackoverflow.  So - I hope for help here.

Essence: on the GUI (JavaFX) there is a button that should launch two processes: the main program code (about 2 seconds) and the wait gif, which runs on top of the GUI.  Accordingly, when the code is executed - the GIF is completed.

What I have done now:
The button's action method blocks the isStarted flag, which gets true when the button is pressed and false after the completion of the main code.  In the main, before launching the GUI, I created a Task, which checks the flag in an infinite loop and, as soon as it gets true, it starts my gif with a separate showGif() method.




Result: the stream starts before the main code, the cycle is spinning, the GIF does not open  - showGif() method stops at pane.setCenter(hb) .  I added Platform.runLater() before calling the showGif() method in Task:

Now the cycle works completely, but the showGif() method is executed only after all the main code.  GIF opens, but no longer needed.

I also tried the call to the showGif() method via Platform.runLater() directly in the button method, without any cycles, flags and Tasks - the result was the same (the GIF starts, but at the end of the program.)  I added three seconds of delay to the main code, in case the GIF just didn't have enough time - the result is the same.

Tell me what am I doing wrong?  I don't see the options.
6 months ago