• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Transforming java slider switch code to Scene Builder control

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all I am trying to figure out how to transform my JavaFX slider switch to a Scene Builder 2.0 control so that I can use it within scene Builder.

I currently have been watching these 2 YouTube videos:

To make the slider switch:

youtube vid 1

To create a scene builder control:

youtube vid 2

The issue with the 2 YouTube videos above is that it shows how to do this with first starting out designing it within Scene Builder 2.0 which is not the way I did it when following the first YouTube video.

So is there a way to transfer what I have in java to the Scene Builder to create the control?

My complete slider switch code:
 
Bartender
Posts: 303
12
IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you figure this out? I'll be honest and confess, although I do use Scene Builder a lot for JFX UIs, I don't really do much (if anything) with custom components in Scene Builder. Generally it's too much hassle and you don't get much in return. What I'll do instead is use Scene Builder to configure a container that a custom component will go into, and then I'll create the custom component in code, adding it to that container at runtime.

If you still REALLY want to get this working, you could try loading some open source 3rd party libs into Scene Builder, and then take a look at how they created the components in their repo. ControlsFX for example is one you could try. (I suspect the 2nd video shows how to do that but it looks like that video is gone now...)

From my own experiments messing around with it before, it seemed like simply pointing SB to any jar, it would magically just find some "components" to add. I never looked into how that works - maybe it's just auto-detecting anything that inherits from Node or something like that.

That code you have above might just work if you point scene builder to it. Just find the jar that it's creating after you do a build and try loading it in SB. You might need to re-create ToggleSwitch as a regular public Java class instead having it private and inline like that, though.
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic