JavaFx:BorderPane中左侧,中间和右侧之间的空格

时间:2017-12-07 10:15:01

标签: java javafx javafx-8

我有BorderPanePane个用于左,右和中间元素,HBox用于顶部元素。我的场景大小为宽度700,高度为600。对于Pane的{​​{1}} setMaxWidth(700 - 400)/2 = 150的左PanePane的右400public class Main extends Application implements EventHandler<ActionEvent> { private static BorderPane gamePane; private static Pane cellsPane; private static HBox buttonsPane; private static Pane statsPane; private static Pane setupsPane; Label cellsCountLabel; static int gameWidth= 700; static int gameHeight=600; @Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("Hello World"); gamePane = new BorderPane(); buttonsPane = new HBox(5); statsPane = new Pane(); cellsPane = makeGrid(20); setupsPane = new Pane(); cellsPane.setStyle("-fx-background-color: #ffffff; -fx-border-color: black"); buttonsPane.setStyle("-fx-background-color: #f2f2f2; -fx-border-color: black"); statsPane.setStyle("-fx-background-color: #f2f2f2; -fx-border-color: black"); setupsPane.setStyle("-fx-background-color: #f2f2f2; -fx-border-color: black"); cellsPane.setMaxWidth(400); statsPane.setMaxWidth((gameWidth-400)/2); setupsPane.setMaxWidth((gameWidth-400)/2); createCellButton = new Button(); deleteCellsButton = new Button(); createCellButton.setText("Create a cell"); deleteCellsButton.setText("Delete cells"); ... buttonsPane.setSpacing(10); buttonsPane.setPadding(new Insets(10, 10, 10, 10)); buttonsPane.getChildren().add(createCellButton); buttonsPane.getChildren().add(deleteCellsButton); gamePane.setTop(buttonsPane); gamePane.setCenter(cellsPane); ... cellsCountLabel = new Label("Cells Count: " + (cellId + 1)); statsPane.getChildren().add(cellsCountLabel); gamePane.setLeft(statsPane); setupsPane.getChildren().add(new Label("Setups Panel")); gamePane.setRight(setupsPane); gamePane.setMargin(statsPane, new Insets(0, 0, 0, 0)); gamePane.setMargin(cellsPane, new Insets(0,0,0,0)); gamePane.setMargin(setupsPane, new Insets(0,0,0,0)); Scene scene = new Scene(gamePane, gameWidth, gameHeight); primaryStage.setScene(scene); ... primaryStage.show(); } ... } 的最大宽度等于Pane }。

Pane

但是,左,中,右Pane之间存在空格。随着Pane s中的内容变大,空间变小,但是当它变得太大时,它会与中心Pane混淆。

enter image description here

enter image description here

每个150都有边框,可以更清楚地看到它的限制。我希望400完全占据150PanegamePane.setMargin(..., new Insets(0, 0, 0, 0));空间,中间没有空格,也不会侵入中心<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd"> (...) <container-descriptor> <prefer-application-packages> <package-name>com.fasterxml.jackson.*</package-name> </prefer-application-packages> </container-descriptor> (...) </weblogic-web-app> 边界。

我尝试使用android { defaultConfig { multiDexEnabled true } } 但它似乎无法正常工作。

0 个答案:

没有答案
相关问题