-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
8u112
-
x86
-
windows_7
Run this sample test, you don't need an actual "test.css" in the project.
"import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.control.TabBuilder;
import javafx.scene.control.TabPane;
import javafx.scene.control.TabPaneBuilder;
import javafx.stage.Stage;
public class TestTabPane extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage paramStage) throws Exception {
TabPane tabPane = TabPaneBuilder.create().build();
for (int i = 1; i <= 10; i++) {
tabPane.getTabs().add(buildTab("tab" + i));
}
Scene scene = new Scene(tabPane, 300, 275);
scene.getStylesheets().add("test.css");
paramStage.setScene(scene);
paramStage.show();
}
public Tab buildTab(String name) {
final Tab tab = TabBuilder.create().closable(true).build();
tab.setText(name);
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().add(new MenuItem("test"));
tab.setContextMenu(contextMenu);
return tab;
}
}
"
Run the sample
Right-click on tab1 header, contextMenu is displayed properly.
Right-click again on tab1 header (while the contextMenu is still displayed), the first contextMenu is hidden, a new ContextMenu is shown, but that time, the right and bottom edge are cut.
I really don't know why it is happening. Only thing I know is that adding a Stylesheet (present in the project or not) in the Scene cause that issue.
Tested with JDK8u112.
"import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.control.TabBuilder;
import javafx.scene.control.TabPane;
import javafx.scene.control.TabPaneBuilder;
import javafx.stage.Stage;
public class TestTabPane extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage paramStage) throws Exception {
TabPane tabPane = TabPaneBuilder.create().build();
for (int i = 1; i <= 10; i++) {
tabPane.getTabs().add(buildTab("tab" + i));
}
Scene scene = new Scene(tabPane, 300, 275);
scene.getStylesheets().add("test.css");
paramStage.setScene(scene);
paramStage.show();
}
public Tab buildTab(String name) {
final Tab tab = TabBuilder.create().closable(true).build();
tab.setText(name);
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().add(new MenuItem("test"));
tab.setContextMenu(contextMenu);
return tab;
}
}
"
Run the sample
Right-click on tab1 header, contextMenu is displayed properly.
Right-click again on tab1 header (while the contextMenu is still displayed), the first contextMenu is hidden, a new ContextMenu is shown, but that time, the right and bottom edge are cut.
I really don't know why it is happening. Only thing I know is that adding a Stylesheet (present in the project or not) in the Scene cause that issue.
Tested with JDK8u112.