r/JavaFX • • Nov 10 '19

Controller class. Now what?

Total newbie here. So I have my @FXML IDs set up.

I have this:

public class Controller {

@FXML

private AnchorPane paneFoo;

}

I want to test if everything works right. I just want to print "Hello World" in that pane but nothing seems to work.

Thanks!

0 Upvotes

6 comments sorted by

View all comments

2

u/Holothuroid Nov 11 '19

That description isn't very helpful. What exactly doesn't work?

Nothing works as in the app doesn't start? Do you have an App class with the proper call? Do you mention the controller in the fxml?

To manipulate the stage on startup you can put a void method called initialize() in your controller. You can use it to add a Label with Hello World to the pane. Or you just write it directly in the fxml. In that case you do not need the orange in the controller.

1

u/GaryBuseyWithRabies Nov 11 '19

I'll tell you my long term goal.

I have an excel spread sheet with my data. I want to create a generic form that repeats this form for every row in the the spreadsheet.

I am lost on how to make this happen.

2

u/AdminOfThis Nov 11 '19

Nothing works as in the app doesn't start? Do you have an App class with the proper call? Do you mention the controller in the fxml?

Would be helpful to answer those specific asked questions, otherwise it is hard to help