Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

JavaFX Scene: Add Scene To Tab

 
John Haywood
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.
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • 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