Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

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 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(
... 62 more** 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??
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic