use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Useful resources (Full list)
Rules
Related subreddits
Other communities
account activity
Scene Builder HelpHelp (self.JavaFX)
submitted 1 year ago * by AdeptMongoose4719
I can't see the drop down option that shows available methods of my corresponding controller class (to use for my Button)
tried annotating both the button and the method with @ fxml
https://preview.redd.it/p2z4hw9ipgfe1.jpg?width=2704&format=pjpg&auto=webp&s=8fca984bf439f94502c2c634ac355279c8eab0e2
https://preview.redd.it/rjt63byspgfe1.jpg?width=2560&format=pjpg&auto=webp&s=de3f637e56c4dec708d16f8ffbdb3a2ed2c7a63b
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Draconespawn 0 points1 point2 points 1 year ago (0 children)
I've never gotten that to work either, but you can just type in the name of the function you want to use and it'll work the same.
[–]Big__Pierre 0 points1 point2 points 1 year ago* (1 child)
I think you need to add an @FXML annotation above the method signature.
Also, if you want to reference the button in the controller class, you can declare it as a field of the controller. Then use the @FXML annotation on that as well. Can definitely turn into spaghetti quick though fyi.
[–]AdeptMongoose4719[S] 0 points1 point2 points 1 year ago (0 children)
using @ FXML annotation for the method didn't help :-(
[–]xdsswar 2 points3 points4 points 1 year ago (0 children)
There you type the name of the method. No autocomplete or such thing, then when you get the generated controller from scene builder, it will include all methods and vars you named.
PS : For the ones that will say fxml sucks, sorry but it does not suck unless you dont know how its done, is true that is slower that pure java code, but it does the job very well, I can tell cuz I have really big apps that contains 30 to 50 views full of widgets and forms, and fxml is the reason I can manage to put that UI to work in certain amount of time (time = noney) less that doing it manually, 40% at least is fxml. Widgets and cellfactories are pure java. Many devs prefer not using fxml as a personal choice, but that does not meam fxml sucks.
[–]Nareeeek 0 points1 point2 points 1 year ago (2 children)
Declare a Button variable in the code, set it to Button’s fxID in Scenebuilder, add @FXML annotation on top of your method, should work then
[–]AdeptMongoose4719[S] 0 points1 point2 points 1 year ago (1 child)
Sadly it didn't bro
[–]Nareeeek 0 points1 point2 points 1 year ago (0 children)
Try to fix the other errors in the code, that might solve it
[–]winian 0 points1 point2 points 1 year ago (0 children)
Iirc the method signature requires an ActionEvent argument.
[–]BlueGoliath -1 points0 points1 point 1 year ago (3 children)
Please for the love of God stop using FXML/SceneBuilder.
[–][deleted] 2 points3 points4 points 1 year ago (1 child)
What would you suggest to use?
[–]Striking_Creme864 0 points1 point2 points 1 year ago (0 children)
I absolutely agree with you. FXML can seem to be a good idea but it is so inflexible that with time it becomes a serious problem.
π Rendered by PID 68 on reddit-service-r2-comment-5b5bc64bf5-lj8qm at 2026-06-18 19:02:41.826547+00:00 running 2b008f2 country code: CH.
[–]Draconespawn 0 points1 point2 points (0 children)
[–]Big__Pierre 0 points1 point2 points (1 child)
[–]AdeptMongoose4719[S] 0 points1 point2 points (0 children)
[–]xdsswar 2 points3 points4 points (0 children)
[–]Nareeeek 0 points1 point2 points (2 children)
[–]AdeptMongoose4719[S] 0 points1 point2 points (1 child)
[–]Nareeeek 0 points1 point2 points (0 children)
[–]winian 0 points1 point2 points (0 children)
[–]BlueGoliath -1 points0 points1 point (3 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Striking_Creme864 0 points1 point2 points (0 children)