DockFX
DockFX copied to clipboard
Programatically control pane size better
At the moment I think I can only specify dock position, it would be nice to be able to specify initial docked size too. For example when creating an initial layout for something like an IDE having the docked logging window at the bottom only using a small (maybe 10%) of the height of the application window.
This should already be possible with setPrefSize https://github.com/RobertBColton/DockFX/blob/913531896e10672bce28bfeade7eda38eb3392e4/src/main/java/org/dockfx/demo/DockFX.java#L98
Please correct me if it does not work however.
I've modified your demo code to illustrate the problem:
private void launchDemo(Stage primaryStage) {
primaryStage.setTitle("DockFX");
// create a dock pane that will manage our dock nodes and handle the layout
DockPane dockPane = new DockPane();
Scene scene = new Scene(dockPane, 800, 500);
NodeManager nodeManager = new NodeManager(dockPane);
DockNode buttons = nodeManager.getDockNode(new VBox(), "Left");
buttons.setPrefSize(100, 450);
buttons.dock(dockPane, DockPos.TOP);
DockNode log = nodeManager.getDockNode(new VBox(), "Bottom");
log.setPrefSize(800, 50);
log.dock(dockPane, DockPos.BOTTOM);
//DockNode canvas = nodeManager.getDockNode(new VBox(), "Middle");
//canvas.setPrefSize(600, 450);
//canvas.dock(dockPane, DockPos.RIGHT, buttons);
//
//DockNode param = nodeManager.getDockNode(new VBox(), "Right");
//param.setPrefSize(100, 450);
//param.dock(dockPane, DockPos.RIGHT, canvas);
primaryStage.setScene(scene);
primaryStage.sizeToScene();
primaryStage.show();
Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
DockPane.initializeDefaultUserAgentStylesheet();
}
Run it like that and you can see the desired proportions.
Add in the uncommented extra panes and I get it that it reverts the bottom pane to 50% of the total height.
Is there any work around available for this issue? or is there any plan to fix this?