-
Bug
-
Resolution: Fixed
-
P3
-
None
As discussed in RT-37855, there are some methods incorrectly using localToScene method.
Some of them break the MenuBar functionality when in SubScene:
public class MenuBarInSubScene extends Application {
private static SubScene createSubScene(Paint fillPaint) {
Group root = new Group();
root.getChildren().add(someNodes());
SubScene subScene = new SubScene(root, 150, 150);
subScene.setFill(fillPaint);
return subScene;
}
private static Parent someNodes() {
final VBox vbox = new VBox();
MenuBar bar = new MenuBar();
final Menu foo = new Menu("Foo");
foo.getItems().addAll(new MenuItem("X"), new MenuItem("Y"));
bar.getMenus().addAll(foo, new Menu("Bar"));
vbox.getChildren().add(bar);
return vbox;
}
@Override
public void start(Stage stage) {
Group root = new Group();
HBox hbox = new HBox();
hbox.setTranslateY(50);
root.getChildren().add(hbox);
Scene scene = new Scene(root);
SubScene plainSubScene = createSubScene(Color.GOLD);
SubScene subSubScene = createSubScene(Color.SILVER);
subSubScene.setHeight(75);
subSubScene.setTranslateY(75);
((Group)plainSubScene.getRoot()).getChildren().add(subSubScene);
hbox.getChildren().add(plainSubScene);
Camera camera = new PerspectiveCamera();
scene.setCamera(camera);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Some of them break the MenuBar functionality when in SubScene:
public class MenuBarInSubScene extends Application {
private static SubScene createSubScene(Paint fillPaint) {
Group root = new Group();
root.getChildren().add(someNodes());
SubScene subScene = new SubScene(root, 150, 150);
subScene.setFill(fillPaint);
return subScene;
}
private static Parent someNodes() {
final VBox vbox = new VBox();
MenuBar bar = new MenuBar();
final Menu foo = new Menu("Foo");
foo.getItems().addAll(new MenuItem("X"), new MenuItem("Y"));
bar.getMenus().addAll(foo, new Menu("Bar"));
vbox.getChildren().add(bar);
return vbox;
}
@Override
public void start(Stage stage) {
Group root = new Group();
HBox hbox = new HBox();
hbox.setTranslateY(50);
root.getChildren().add(hbox);
Scene scene = new Scene(root);
SubScene plainSubScene = createSubScene(Color.GOLD);
SubScene subSubScene = createSubScene(Color.SILVER);
subSubScene.setHeight(75);
subSubScene.setTranslateY(75);
((Group)plainSubScene.getRoot()).getChildren().add(subSubScene);
hbox.getChildren().add(plainSubScene);
Camera camera = new PerspectiveCamera();
scene.setCamera(camera);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
- relates to
-
JDK-8093268 [Monocle/Embedded] exception when using virtual keyboard
- Resolved
-
JDK-8098097 Providing Node.localToWindow()
- Resolved