-
Bug
-
Resolution: Fixed
-
P4
-
jfx15
-
generic
-
generic
-
Not verified
A DESCRIPTION OF THE PROBLEM :
In a program I create several tabs and initialize a selected tab upfront.
The 'select' command works fine for the tab pane content but unfortunately not for the header that shows the current active tab (somehow the tab header does not move to the set index).
Note1: Only happens for indices outside the visible range
Note2: wrapping the 'select' command in Platform.runLater() works as expected
Find below a simple example to reproduce the issue.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simple example attached that illustrates the issue.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The TabHeader of the selected Tab should be brought into view.
Wrapping it inside Platform.runLater() works.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;
public class TestManyTabs extends Application {
@Override
public void start(Stage stage) {
TabPane tabPane = new TabPane();
for (int i = 0; i < 30; i++) {
Tab tab = new Tab("Tab " + i);
tab.setContent(new Label("Content for " + i));
tabPane.getTabs().add(tab);
}
// set initial tab *outside* the visible range
// Issue: tab header does *not* switch properly
// Note: wrapping the following select statement in Platform.runLater() works as expected
// Platform.runLater(() -> {
tabPane.getSelectionModel().select(25);
// });
Scene scene = new Scene(tabPane, 600, 400);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
Application.launch(TestManyTabs.class, args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Wrapping it inside Platform.runLater()
FREQUENCY : always
In a program I create several tabs and initialize a selected tab upfront.
The 'select' command works fine for the tab pane content but unfortunately not for the header that shows the current active tab (somehow the tab header does not move to the set index).
Note1: Only happens for indices outside the visible range
Note2: wrapping the 'select' command in Platform.runLater() works as expected
Find below a simple example to reproduce the issue.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simple example attached that illustrates the issue.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The TabHeader of the selected Tab should be brought into view.
Wrapping it inside Platform.runLater() works.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;
public class TestManyTabs extends Application {
@Override
public void start(Stage stage) {
TabPane tabPane = new TabPane();
for (int i = 0; i < 30; i++) {
Tab tab = new Tab("Tab " + i);
tab.setContent(new Label("Content for " + i));
tabPane.getTabs().add(tab);
}
// set initial tab *outside* the visible range
// Issue: tab header does *not* switch properly
// Note: wrapping the following select statement in Platform.runLater() works as expected
// Platform.runLater(() -> {
tabPane.getSelectionModel().select(25);
// });
Scene scene = new Scene(tabPane, 600, 400);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
Application.launch(TestManyTabs.class, args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Wrapping it inside Platform.runLater()
FREQUENCY : always
- relates to
-
JDK-8253352 TabPane: issues when/after dragging tab header
-
- Open
-