-
Bug
-
Resolution: Fixed
-
P4
-
7u45
Include a TabPane in a Scene with a large number of tabs.
Upon initial launch, the stage won't be wide enough to show all tabs and a dropdown arrow will appear
Now use the dropdown to select the last tab.
Maximize the window and notice how the tabs are not re-positioned correctly to take advantage of the additional space.
Sometimes clicking on another tab will cause the layout to correct, other times it does not.
The TabPane should recognize when it is resized and correctly layout its tabs.
Code to produce this:
{code:title=Misbehaving Tabs|borderStyle=solid}
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.SceneBuilder;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TabPaneBuilder;
import javafx.stage.Stage;
public class SimpleSandboxApp extends Application
{
private TabPane _tabs;
private Parent buildRoot()
{
int numTabs = 15;
Tab[] tabs = new Tab[numTabs];
for(int i = numTabs; i-->0; )
tabs[i] = new Tab("Some Random Tab");
_tabs = TabPaneBuilder.create()
.tabs(tabs)
.build();
return _tabs;
}
@Override
public void start(Stage stage) throws Exception
{
stage.setScene(SceneBuilder.create()
.root(buildRoot())
.build());
stage.setTitle("Simple Sandbox");
stage.show();
}
public static void main(String[] args)
{
Application.launch(args);
}
}
{code}
Upon initial launch, the stage won't be wide enough to show all tabs and a dropdown arrow will appear
Now use the dropdown to select the last tab.
Maximize the window and notice how the tabs are not re-positioned correctly to take advantage of the additional space.
Sometimes clicking on another tab will cause the layout to correct, other times it does not.
The TabPane should recognize when it is resized and correctly layout its tabs.
Code to produce this:
{code:title=Misbehaving Tabs|borderStyle=solid}
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.SceneBuilder;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TabPaneBuilder;
import javafx.stage.Stage;
public class SimpleSandboxApp extends Application
{
private TabPane _tabs;
private Parent buildRoot()
{
int numTabs = 15;
Tab[] tabs = new Tab[numTabs];
for(int i = numTabs; i-->0; )
tabs[i] = new Tab("Some Random Tab");
_tabs = TabPaneBuilder.create()
.tabs(tabs)
.build();
return _tabs;
}
@Override
public void start(Stage stage) throws Exception
{
stage.setScene(SceneBuilder.create()
.root(buildRoot())
.build());
stage.setTitle("Simple Sandbox");
stage.show();
}
public static void main(String[] args)
{
Application.launch(args);
}
}
{code}