为什么将文件导出为Jar会改变我的HBox外观?它改变了我一些HBox容器作为jar的大小,但是当我在Eclipse中编译时,我得到了预期的大小。导出为jar也会使我的窗口比在eclipse中编译时小。
Text1.setPrefWidth(550);
Text2.setPrefWidth(550);
HBox text1 = new HBox(new Label("text:"), Text1);
HBox text2 = new HBox(new Label("text:"), Text2);
combo.getItems().addAll(
"a",
"b",
"c"
);
combo.setMaxWidth(150);
HBox textFieldContainer = new HBox(
new Label("text3"),
Text3,
new Label("combo"),
combo);
Text1.setSpacing(6);
Text1.setAlignment(Pos.CENTER);
Text2.setSpacing(6);
Text2.setAlignment(Pos.CENTER);
textFieldContainer.setSpacing(6);
textFieldContainer.setAlignment(Pos.CENTER);
bt1.setPrefSize(100, 0);
bt2.setPrefSize(100, 0);
bt3.setPrefSize(100, 0);
bt4.setPrefSize(100, 0);
HBox buttonContainer = new HBox(bt1, bt2, bt3, bt4);
buttonContainer.setSpacing(6);
buttonContainer.setAlignment(Pos.CENTER);
VBox pane = new VBox(text1, text2, textFieldContainer, buttonContainer);
pane.setPadding(new Insets(11.5, 12.5, 13.5, 14.5));
pane.setSpacing(7);
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.show();