• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How to load same main fxml file multiple times by clicking on the new tab button?

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to add new tab functionality to browser.I already search a lot on google but nothing work.I want to load main fxml file again nad again dynamically by clicking on new tab button.

Below is Main.java file

Here is some part of First-page.fxml file which is the main view...

Below is controller of First-page.fxml


In Controller class Tab-First-page.fxml is the copy of first-page.fxml and changes in Tab-first-page.fxml is that it does not contain Tabpane otherwise it is same as First-page.fxml
I am able to load multiple tab from First-page.fxml but not able to open new tab from Tab-first-page.fxml that is, From main page multiple tabs can be open dynamically but from those open tabs I am not able to open new tabs. Following is the error I am getting...

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
//Lot more error...
**Caused by: java.lang.NullPointerException
at tabcheck.Home_controller.addTab(Home_controller.java:200)
... 62 more**
Home_controller.java:200 is tabpane.getTabs().add(tab); in addTab() method. I have tried every possible solution but not working,please any one can help?

I have also try to do it by adding listener in addTab() but still null pointer exception is coming...also search on other websites but nothing is working...please anybody can help??
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!