JavaFX UI: iOS Style Toggle Switch

Поділитися
Вставка
  • Опубліковано 21 сер 2024
  • In this tutorial we make a nice lightweight UI control - Toggle Switch and we are going to be model it based on iOS 8 style toggle switch.
    Source code: github.com/Alm...
    If you do want to achieve that shadow effect on the left image, you can do the following and maybe play around with shadow properties:
    DropShadow shadow = new DropShadow();
    shadow.setRadius(2);
    trigger.setEffect(shadow);
    Please complete this 3 question survey which takes less than 10 seconds www.surveymonk... so I can improve the channel content

КОМЕНТАРІ • 14

  • @bartekolczak7901
    @bartekolczak7901 3 роки тому +1

    this was fine for me - especially you shown example with Bindings thx!

  • @JyothiprasadBuddha
    @JyothiprasadBuddha 7 років тому +3

    An Excellent tutorial with cool and practical application and demonstration. Keep it up.

  • @PedroGometz
    @PedroGometz 7 років тому +4

    Thanks. This was really useful. I did a slight tweak. As it stands, if you click on the switch again while the animation is still running, it gets out of sync. I resolved this by having a boolean 'busy' flag that I set on click (and clicks received when busy==true are ignored) and then clear the flag in the onFinished handler for the animation.

    • @AlmasB0
      @AlmasB0  7 років тому +2

      Well done. You will also find that the same tweak should work across many tutorials on this channel related to UI & event handling.

    • @gordondamerau4268
      @gordondamerau4268 6 років тому

      Nice tutorial. Maybe a bit late but I had the same problem and solved it by using "animation.playFromStart();" instead of "animation.play();"

  • @yas2591
    @yas2591 6 років тому

    now we can use the JFXToggleButton of the JFoenix library

  • @lakshminarke5085
    @lakshminarke5085 6 років тому

    I am not able to add multiple toggle buttons on the same pane? Can you tell me how to do it? Thank-you

  • @phanhuutho
    @phanhuutho 6 років тому

    Thank you very much for awesome tutorial. Could I use your code in my project?
    If any, do I need to cite any license from you? Please let me know. Thank you.

    • @AlmasB0
      @AlmasB0  6 років тому +1

      Sure, the code for all tutorials is released under MIT

  • @user-fy4ii4ro6p
    @user-fy4ii4ro6p 3 роки тому

    我有个问题:如果快速点击的话,很可能数据和显示不一致,要怎么解决?(If you click quickly, it is likely that the data and display are inconsistent. How to solve this problem?)

    • @AlmasB0
      @AlmasB0  3 роки тому +1

      Generally, this category of problems can be solved by keeping track of the animation state in a boolean. If already animating, don't toggle.

  • @viejowaterfall2
    @viejowaterfall2 4 роки тому

    u can do the same with css

  • @useryoutube7731
    @useryoutube7731 2 роки тому

    Hello, How can I add this toogle button or pane as component to my scene builder project? I mean for make this toogle button manually but make rest of gui in scene builder(fxml file) Thank you in advance for your help

    • @useryoutube7731
      @useryoutube7731 2 роки тому

      now I solved that but anyway, thank you for your tutorial, it is very helpful