Javafx 3D disapear in split pane - java

I developed a 3d plotting tool (so-called A; which is a subscene). I want to put this subscene in a Split Pane (B). The problem is a part of my scene disappears (when I rotate the plot some parts appear). as you can see below:
trauncated plot
However; when I use HBox or Pane instead of SplitPane, everything works well.
the code is here(I simplified it for better understanding)
SplitPane splitPane = FXMLLoader.load(getClass().getResource("sample.fxml"));
Scene scene =new Scene(splitPane);
Pane pane = new HBox();
pane.getChildren().add(A);
splitPane.getItems().add(pane);
primaryStage.setScene(scene);

I solve it. It is a little bit tricky but in the subcode of sub-scene A; I use Stackpane as a root. I changed it to Group. everything works well.

Related

How do I make a fixed size grid-pane in JavaFX Scene Builder?

I'm trying to make a centered grid pane in the JavaFX scene builder which stays a fixed size. I'm having a hard time doing this myself. Anything I can do?
I'm trying to accomplish something like this:
You can use stackpane as parent of your gridpane

How do I fix blurry nodes when added to a Stackpane?

I'm currently working on a javafx project and I keep running into the problem with blurry nodes when they are added to a Stackpane.
I have tried using setSnapToPixel(true) on the Stackpane but I still end up with a blurry result.
Stackpane pane = new Stackpane(new NodeConsole(15)); //I get a blurry result
primaryStage.setScene(new Scene(pane));
primaryStage.show();
When I use a Group I get this:
Clear Image
When I use a Stackpane I get this:
Blurry Image

How to overlay GUI over 3D scene in JavaFX?

I have a 3D scene in JavaFX and need to overlay GUI over the 3D scene. I have tried adding buttons and text to the scene but they always appear in the 3d view as 3D objects. I have looked around and haven't found how to do it. The only workaround would be creating a whole new window and putting the settings there but that isn't an option in this case. Thanks for the help!!
Something like this
Or this
The best solution for what you are looking for is the SubScene, a built-in JavaFX container:
The SubScene class is the container for content in a scene graph. SubScene provides separation of different parts of a scene, each of which can be rendered with a different camera, depth buffer, or scene anti-aliasing. A SubScene is embedded into the main scene or another sub-scene.
If you have a look at the 3DViewer project, you'll find it is like the pictures you have posted:
You can find a small sample of how to add a subScene to a regular scene in this question.

How to keep JavaFX MenuBar in the top part of the window

I'm trying to make an window, where I have StackPane as root and I want to add MenuBar to this window. However MenuBar is in the center of the screen and I want to keep it in the top part of the window as in normal Windows applications.
root = new StackPane();
root.getChildren().add(new MenuBar());
this will show window like this
http://i61.tinypic.com/2pzblmo.jpg
Thanks you for your advice!
I would say StackPane is not suitable for making a GUI including a menubar.
StackPane will just put the controls you add to it one on top of the other.
In java docs you can find:
"StackPane
The StackPane layout pane places all of the nodes within a single stack with each new node added on top of the previous node. This layout model provides an easy way to overlay text on a shape or image or to overlap common shapes to create a complex shape. Figure 1-6 shows a help icon that is created by stacking a question mark on top of a rectangle with a gradient background.
"

adding nodes into anchorPane buggs window layout

I have this problem:
I am using javaFX and scene builder (2.0) and I have placed scrollPane into my window, which in turn contains anchorPane. When I start my application everything works ok, but when I programmatically/dynamically add nodes into the anchorPane, for some reason whole layout of my app gets weird/buggy. Basically everything stays in the prefWidth and prefHeight and does not resize when resizing the app's window, while before adding for example Polyline into the anchorPane there wasn't any problem.
It affects practically all nodes (menubar, vertical toolbar) which aren't even in the anchorPane...
here is piece of my code:
//initialize function of my cotroller class
anchorPane = new AnchorPane();
anchorPane.getChildren().add(canvas);
scrollPane.setContent(anchorPane);
...
//dynamic node insert
Polyline polyline = new Polyline(...);
...
anchorPane.getChildren.add(polyline);
//and now the whole app's layout is bugged
Thanks for answers.
I managed to fix it by changing AnchorPane to Pane.

Categories

Resources