• 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 ...
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown

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

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
Trust God, but always tether your camel... to this tiny ad.
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic