My task is creating the resizable graph in full screen mode. Graph must be resizable when user change the window of program that is fullscreen by default (the components and lines of graph change their sizes). I realize the graph with AnchorPane
: the elements (that are GridPane
s) stay in coordinates that are defined. Then I make the lines with the help of method getBoundsInParent()
. Here is the scema of graph:
All is good but the problem is that I can t resize my graph. All components are stayed with their sizes; variables prefSize
, minSize
, maxSize
don't do the resizing. I try using the params AnchorPane.setTopAnchor
etc., but they don t resize, only move the GridPane
component.
Also I try to use GridPane
as the layout instead the AnchorPane
. But my lines that are binded with the methods component.getBoundsInParent()
fly away in random positions (I understand that the getBoundsInParent()
method returns other coordinates that with GridPane
).
My project is located at work computers without Internet & I can t show it. I think the way of binding the lines between graphs is useful to show in code block because it is the cause of moving out the lines when the components are in GridPane layout:
line.startXProperty().bind(source.layoutXProperty().add(source.getBoundsInParent().getWidth() / 2.0));
line.startYProperty().bind(source.layoutYProperty().add(source.getBoundsInParent().getHeight() / 2.0));
line.endXProperty().bind(target.layoutXProperty().add(target.getBoundsInParent().getWidth() / 2.0));
line.endYProperty().bind(target.layoutYProperty().add(target.getBoundsInParent().getHeight() / 2.0));
What is the way to resize the graph with elements that I create and lines that are connected with this elements. May be it s the properties of AnchorPane
or GridPane
? Or some binding of start & endpoints of lines?