troubleshooting Question

Javafx passing parameters before loading the fxml loader

Avatar of Panos
PanosFlag for Germany asked on
5 Comments1 Solution12 ViewsLast Modified:
Hi experts . I m trying to pass parameters to fxml loader before loading the controller to define the gui how it should look like and what it should include a.s.o.
I have a main container and after clicking on buttons this container is loading the data from fxml. like this:
private StackPane acContent;
private void btnSupplierOnClick(ActionEvent event) throws IOException {
  FXMLLoader fxmlLoader = new FXMLLoader();
  AnchorPane acPane = fxmlLoader.getRoot();
  ViewSupplierListController supplierListController = fxmlLoader.getController();
  // Passing data to the supplierListController

Open in new window

With the setData function i m passing values to the controller but this happens after the controller has been loaded.
After googling i found a solution here (1. Create a controller instance manually) but i didn t get it to work.
Any help to solve my problem?
Thank you in advance.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 5 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 5 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004