Knute Snortum wrote:I don't know if that is possible. The two GUIs need to interact? If it's a login to a server, maybe test the login first, then launch the second GUI. Maybe the first GUI talks to the second through a socket.
I think I need to know your use case. Normally, to log into a server, then use that connection, you would use the model I showed you. Why do you need to launch a program, login, then go back to launching program to continue?
Knute Snortum wrote:In general, you don't launch several applications in JavaFX, but you can use several stages. Stages can be hidden or shown as needed.
So in your case, I would launch the a main GUI but not show the stage. Then create a second stage that is the login window and show it. Once the user has successfully logged on, hide the login stage and show the main stage.
Knute Snortum wrote:I pasted the classes into an IDE and ran the Main class, but I'm not sure what I'm seeing or what I'm supposed to see. I'm assuming P1 and P2 are player one and two, and I can move them by dragging them to adjacent sectors, but I don't know what the problem is. Sometimes the piece moves where I drag it and sometime not, but I don't see any pattern to it.
I think you need to explain what the desired output is and what the problem is.
Paul Clapham wrote:It's normal in most GUI systems that, if you cause the GUI's thread to sleep, that blocks the whole GUI. I don't know specifically about Java FX but I can tell you that's how it works in Swing.
So you're going to have to recast your code so that it works according to the way that GUI's want to work. You already have a requirement which says something like "When the user clicks on X then such and such should start happening"; that suggests that you should have a listener attached to X which tells you when the user clicks there. When that happens, your code should cause that other stuff to start happening.
Norm Radder wrote:
need the player to move an object on the screen before the games continues
Normally that is done by the program letting the JVM do the waiting until a user created event. When the player moves, that creates an event the JVM will pass to a listener in the code where the the game can continue.
Do not use calls to sleep to do any waiting on user actions.
I am not familiar with JavaFX so can not recommend techniques to use there.