JavaFX Java GUI Tutorial – 4 – Switching Scenes

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

36 responses to “JavaFX Java GUI Tutorial – 4 – Switching Scenes”

  1. Lubor Pešek Avatar

    guys, how can I repaint scenes after switching?
    I found that you can repaint it by this code: scene1.getRoot().requestLayout();
    requestLayout() is like repaint() in swing, but it doesnt work for me….
    If i switch these scenes, sometimes appears black background. I can fix it only by resizing the window, so how can i repaint it?

  2. Captain Angry Avatar

    why dont you use an fxml for designing the interface? doing everything in java code is more work

  3. jonathan rogers Avatar

    Been following ur tutorials since I decided to go back to school, appreciate them!

  4. Marvin Otieno Avatar

    The button on which am setting the action cannot be seen by the method that handles the event(the overridden method), why is that??

  5. jmastaice Avatar

    "…pretty stinkin' awesome" XD

  6. B1TC0R3 Avatar

    Hey there, I have the same problem James Till mentioned before. The skript is the same, but if i press a button, nothing happenes. IM using eclipse oxygen, windows 8. Any ideas how to fix it?

  7. Cilicili Bubu. Avatar

    Anyone know why window = primarystage ?
    Cannot direct use primarystage?

  8. Jisu Lee Avatar

    yesterday I found myself mumbling "I, love, switching, scenes, I, love…" while taking a shower.

  9. Kai Schaffarczyk Avatar

    Hey thenewboston! Great video, but I wonder if you can make a video about using multiple scenes in one stage. I didn´t really find a good tutorial on Youtube or even StackOverFlow and it would be awesome if you could add another great video to this playlist!

  10. Why Not To Have Fun Avatar

    this is awesome, except that it doesn't work, it shuts down the event handling thread, what to do? some more Win10 issues?(it does work but doesnt switch scenes, code is the same, so its not that)

  11. soroush saberan Avatar

    What's the difference between a VBox and a StackPane?

  12. Adolph Sheh Avatar

    Very Helpful. But how about if we have menu and tool UI in the APP, and layout1 and layout2 share the same menu and tool. should I need to add it both in layout1 and layout2? does it will reload during we switch the scene?

  13. Muntasir Abir Avatar

    Bucky you are stinkin funny and genius :p

  14. Jesse Fiedler Avatar

    Is it possible to add a single button object to more than one scene?

    When I try to do this, my button is removed from the first scene

  15. J0xxe Avatar

    8:05 literally started doing that myself at the same time, HAHA

  16. Muhammad Andri Avatar

    how to use in controller?

  17. The_New_Eternet_Hero Avatar

    For the window stage why don't you just rename the primary stage object in the start method parameters.

  18. Dum Spammers Avatar

    You got forgot to import import javafx.scene.control.Label;

  19. KOP KIYAK Avatar

    i need this but i have to do it in the main controller with scene builder..

  20. Roland Pogonyi Avatar

    Switching scenes is not working reliably with embedded Java. Do not do this on Raspberry PI for example.

  21. James Till Avatar

    I have a problem.

    When I run, the scene pops up, but the button press doesn't change the scene. If I call "window.setScene(scene2);" it'll load that scene instead, but I can't swap the scenes. I've gone over the code, and I don't see any differences.

  22. Robert Roby Avatar

    MAN I LOVE YOU ! THANK YOU SO MUCH ! 😀

  23. donald trump Avatar

    what about scenes from a different class?

  24. Ella Vantas Avatar

    hello, is there a way for me to separate the gui components in javafx? like in java swing, i can create multiple classes of jpanels and assemble them in a jframe of another class?

  25. Yevhen Rudenko Avatar

    man, u r awesome! Very clearly and simple material describing! Thank you a lot!

  26. dibyendu brinto Avatar

    thanks please make some videos about simple java project like simple chat messneger,web browser etc 🙂

  27. Abdelhadi Naimi Avatar

    you could'v just renamed primaryStage to window

  28. Will Avatar

    wtf? so much easier than fucking swing and cardlayout

  29. bkbenelli Avatar

    Awesome tutorials. Would love to see the Advanced Java that you talked about in the last JavaFX video! They've got some awesome features in recent Java releases that I'm definitely not taking full advantage of.

  30. mshin54 Avatar

    You are hilarious! Thanks for the tutorial.

  31. Nolorwolf Avatar

    If you don't define import for Label in Eclipse, it gets it from awt instead of javafx, and add/addAll() methods fail.

    If anyone knows how to set defaults to FX, feel free to reply 🙂

  32. Juliano Avatar

    OOOO my god!! sorry please, definition "Stage acene1, acene2;' correct 'Scene acne1, acene2;' Sorry

  33. Juliano Avatar

    Help me please, Im IDE Netbeans error "Incompatible types: Scene cannot be converted to Stage… You'r help me

  34. Ismahene Larbi Avatar

    Very useful but how can we switch scenes using scene builder? if I am correct, using scene builder implies putting the code in the controller class and not main so how would that work ?

Leave a Reply

Your email address will not be published. Required fields are marked *