enter image description here

I can not extend the height of the TableView , I layout'ы tried all the layout'ы — nothing helps. I do not understand what the problem is.

I insert it into the center border pan 'and another window, the buttons are adjusted, the table is not. In height, everything stands on MAX_VALUE . Help me please.

 <?xml version="1.0" encoding="UTF-8"?> <?import com.jfoenix.controls.*?> <?import java.lang.*?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import com.jfoenix.controls.JFXButton?> <?import javafx.geometry.Insets?> <?import javafx.scene.control.Pagination?> <?import javafx.scene.control.TableView?> <?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.VBox?> <fx:root maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="400.0" prefWidth="600.0" type="BorderPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <bottom> <HBox prefHeight="49.0" prefWidth="600.0" BorderPane.alignment="CENTER"> <children> <JFXButton fx:id="btnAdd" alignment="TOP_LEFT" prefHeight="25.0" prefWidth="160.0" text="ДОДАТИ"> <HBox.margin> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </HBox.margin> </JFXButton> <JFXButton fx:id="btnEdit" alignment="TOP_LEFT" prefHeight="25.0" prefWidth="160.0" text="ЗМІНИТИ"> <HBox.margin> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </HBox.margin> </JFXButton> <JFXButton fx:id="btnDelete" alignment="TOP_LEFT" prefHeight="25.0" prefWidth="163.0" text="ВИДАЛИТИ"> <HBox.margin> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </HBox.margin> </JFXButton> </children> </HBox> </bottom> <center> <VBox> <children> <VBox VBox.vgrow="ALWAYS"> <children> <TableView fx:id="tableView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS" /> <Pagination fx:id="pagination" VBox.vgrow="ALWAYS" /> </children> </VBox> </children> </VBox> </center> </fx:root> 

I add it here through dictionaryBorderPane.setCenter ((Node) mainListView.getSelectionModel (). GetSelectedItem ());

 <Tab fx:id="tabDictionary" onSelectionChanged="#handleDictionaryTab" text="Довідники"> <content> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"> <children> <BorderPane fx:id="dictionaryBorderPane" prefHeight="975.0" prefWidth="1920.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <left> <JFXListView fx:id="mainListView" prefWidth="300.0" BorderPane.alignment="CENTER" /> </left> </BorderPane> </children></AnchorPane> </content> </Tab> 

    2 answers 2

    AnchorPane can help you.

     <AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <children> <TableView AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <columns> <TableColumn prefWidth="75.0" text="C1" /> <TableColumn prefWidth="75.0" text="C2" /> </columns> </TableView> </children> </AnchorPane> 
    • Does not help. I put it in the window using the borderPane.setCenter ((Node) table with 3 buttons ..) if I shove only the tableView then it stretches, but along with the buttons that do not want at the bottom. what can be done? would throw the entire fxml file, but only 1 line inserts - Leonardo DiCaprio
    • Show the code. The place that you described. - Mikhail Vaysman
    • How can I insert it here? can you tell? - Leonardo DiCaprio
    • @ LeonardoDicaprio add it to the question. Code snippet is indented with 4 spaces - Mikhail Vaysman
    • he added that in this situation the table is only wide by the content of the columns, only half open. she's tied to prefHeight don't know why - Leonardo Dicaprio
     <?xml version="1.0" encoding="UTF-8"?> <?import com.jfoenix.controls.JFXButton?> <?import javafx.geometry.Insets?> <?import javafx.scene.control.Pagination?> <?import javafx.scene.control.TableView?> <?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.VBox?> <fx:root maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="400.0" prefWidth="600.0" type="BorderPane" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> <bottom> <HBox prefHeight="49.0" prefWidth="600.0" BorderPane.alignment="CENTER"> <children> <JFXButton fx:id="btnAdd" alignment="TOP_LEFT" prefHeight="25.0" prefWidth="160.0" text="ДОДАТИ"> <HBox.margin> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </HBox.margin> </JFXButton> <JFXButton fx:id="btnEdit" alignment="TOP_LEFT" prefHeight="25.0" prefWidth="160.0" text="ЗМІНИТИ"> <HBox.margin> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </HBox.margin> </JFXButton> <JFXButton fx:id="btnDelete" alignment="TOP_LEFT" prefHeight="25.0" prefWidth="163.0" text="ВИДАЛИТИ"> <HBox.margin> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </HBox.margin> </JFXButton> </children> </HBox> </bottom> <center> <VBox> <children> <StackPane alignment="TOP_RIGHT" VBox.vgrow="NEVER"> <children> <JFXButton alignment="TOP_LEFT" contentDisplay="RIGHT" ripplerFill="#ed6464" text="QWEQWE" textAlignment="RIGHT" textFill="#3b2d2d" /> </children> </StackPane> <VBox VBox.vgrow="ALWAYS"> <children> <TableView fx:id="tableView" VBox.vgrow="ALWAYS" /> <Pagination fx:id="pagination" /> </children> </VBox> </children> </VBox> </center> </fx:root> 

    Pay attention to VBox.vgrow

    • I updated the picture with your code, when I added VBox.vgrow to the pagination it stretched, the table still does not want. put the MAX_VALUE in height and width, without him also thanks for the reply - Leonardo DiCaprio