Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
    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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JavaFX Scene: Add Scene To Tab

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator


Tab tab1 = new Tab();
Tab tab2 = new Tab();

How do I add a scene to a Tab? I want to make it so when tab1 is selected the scene is showing and when switched to tab2, it is not there.

I tried doing tab1.setContent, it has to be a node.
I tried doing dialog.setOwner(tab1), it has to be a window.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi John, and welcome to the Ranch!

John Haywood wrote:How do I add a scene to a Tab?


As you've already discovered, you can't. What you can do is add whatever you specified as the Scene's root to the tab instead.

John Haywood wrote:I tried doing dialog.setOwner(tab1), it has to be a window.


Hint: Stage is-a Window.

For future reference, please BeForthrightWhenCrossPostingToOtherSites.
 
John Haywood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator

Darryl Burke wrote:Hi John, and welcome to the Ranch!

John Haywood wrote:How do I add a scene to a Tab?


As you've already discovered, you can't. What you can do is add whatever you specified as the Scene's root to the tab instead.

John Haywood wrote:I tried doing dialog.setOwner(tab1), it has to be a window.


Hint: Stage is-a Window.

For future reference, please BeForthrightWhenCrossPostingToOtherSites.



Stop patronizing me. What I want to create is an MDI in JavaFX, so just putting the content in there will not help.
 
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Link to the crosspost. (The point of mentioning that something is crossposted is so that someone doesn't waste time answering when you already have an answer.)

As I see from the cross post, the answer was to create a custom tab.
 
    Bookmark Topic Watch Topic
  • New Topic