1

Why does exporting a file as a Jar change how my HBox look? it changed the size of some of my HBox containers as a jar but when I compile in eclipse, I get the expected size. exporting as a jar also makes my window smaller than when i compile in 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();
Exalino
  • 39
  • 6
  • I added an example of my code, it's just very basic code with me adding textboxes and buttons to my program. all of the Text and bt variables are defined outside of the method. – Exalino Jul 04 '19 at 20:51
  • Does setting the size of the text fields and buttons not count? – Exalino Jul 05 '19 at 15:34
  • I cannot reproduce the I have the exact same size when complied vs jar Im on Java8 IntelliJ. The only difference in code could be that I used Text1,2,3 as Textfields because its not initialized in the given code – Matt Jul 05 '19 at 16:07

0 Answers0