Difference between Scenebuilder and Javafx Application

Asked

Viewed 631 times

0

People I am using Scene Builder 2.0 to make the Layout of my Javafx application. When I see the application through Scene Builder everything is ok, but when I run the Javafx application the side is not the same as the design of Scene Builder, it gets a bigger space on the right side, I attached a print of each so you can see the difference. The first is the app image, the second from Scene Builder Imagem do Aplicativo

Imagem Scene Builder 2.0

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<TabPane fx:id="tabPane" prefHeight="558.0" prefWidth="628.0" tabClosingPolicy="UNAVAILABLE" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="br.com.grupor.controlepostal.viewController.CadastroDestinatarioViewController">
   <tabs>
      <Tab fx:id="tabLista" text="Destinatários">
         <content>
            <FlowPane prefHeight="506.0" prefWidth="618.0">
               <children>
                  <Label contentDisplay="CENTER" text="Filtrar Destinatário">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textFiltrarDestinatario" onKeyReleased="#filtrarDestinatarioOnReleased" prefHeight="25.0" prefWidth="510.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="Destinatários Localizados">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <ComboBox fx:id="comboBoxLocalizados" prefHeight="25.0" prefWidth="473.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" top="5.0" />
                     </FlowPane.margin>
                  </ComboBox>
                  <FlowPane alignment="CENTER_RIGHT" prefHeight="35.0" prefWidth="624.0">
                     <children>
                        <Button fx:id="btnNovo" mnemonicParsing="false" onAction="#btnNovoOnAction" text="Novo">
                           <FlowPane.margin>
                              <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                           </FlowPane.margin>
                        </Button>
                        <Button fx:id="btnAlterar" mnemonicParsing="false" onAction="#btnAlterarOnAction" text="Alterar">
                           <FlowPane.margin>
                              <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                           </FlowPane.margin>
                        </Button>
                        <Button fx:id="btnExcluir" mnemonicParsing="false" onAction="#btnExcluirOnAction" text="Excluir">
                           <FlowPane.margin>
                              <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                           </FlowPane.margin>
                        </Button>
                     </children>
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </FlowPane>
                  <TableView fx:id="tableViewLista" onMouseClicked="#tableViewListaClicked" prefHeight="404.0" prefWidth="619.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TableView>
               </children>
            </FlowPane>
         </content>
      </Tab>
      <Tab fx:id="tabCadastro" text="Cadastro">
         <content>
            <FlowPane prefHeight="529.0" prefWidth="592.0">
               <children>
                  <Label text="Destinatário">
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                  </Label>
                  <TextField fx:id="textDestinatario" prefHeight="27.0" prefWidth="547.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <ComboBox fx:id="comboBoxTipoPessoa" prefWidth="150.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </ComboBox>
                  <Label text="Documento">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textDocumento">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="OBS">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textObs" prefHeight="25.0" prefWidth="196.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="CEP">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textCep" prefHeight="25.0" prefWidth="75.0" />
                  <Label text="Endereço">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textEndereco" prefHeight="25.0" prefWidth="455.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="Complemento">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textComplemento" prefHeight="25.0" prefWidth="214.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="Bairro">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textBairro" prefHeight="25.0" prefWidth="269.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="Cidade">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textCidade" prefHeight="25.0" prefWidth="482.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="Estado">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textEstado" prefHeight="25.0" prefWidth="36.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="E-mail">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textEmail" prefHeight="25.0" prefWidth="330.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <Label text="Contato">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </Label>
                  <TextField fx:id="textContato" prefHeight="25.0" prefWidth="184.0">
                     <FlowPane.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </FlowPane.margin>
                  </TextField>
                  <FlowPane alignment="TOP_RIGHT" prefHeight="35.0" prefWidth="631.0">
                     <children>
                        <Button fx:id="btnCancelar" mnemonicParsing="false" onAction="#btnCancelarOnAction" text="Cancelar">
                           <FlowPane.margin>
                              <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                           </FlowPane.margin>
                        </Button>
                        <Button fx:id="btnSalvar" mnemonicParsing="false" onAction="#btnSalvarOnAction" text="Salvar">
                           <FlowPane.margin>
                              <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                           </FlowPane.margin>
                        </Button>
                     </children>
                     <FlowPane.margin>
                        <Insets />
                     </FlowPane.margin>
                  </FlowPane>
               </children>
            </FlowPane>
         </content>
      </Tab>
   </tabs>
</TabPane>
  • You can add your fxml code?

  • ready added fxml

  • Amigo take a look at the XML of your layout and modify the values , because a file generated by Scenebuilder is not always the same in preview .

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.