Ciao a tutti,
scrivo per un problemino che non riesco proprio a risolvere.
Sto realizzando un'applicazione desktop con JAVAFX e vorrei che fosse in qualche modo responsive.
Ho una prima pagina fxml chiamata Home.fxml
codice:
<AnchorPane fx:id="home" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="800.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="HomeController"> <children> <VBox fx:id="homeVbox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <children> <HBox fx:id="header" alignment="CENTER" prefHeight="15.0" prefWidth="800.0" > <children> <Label alignment="CENTER" text="Home" textFill="WHITE" wrapText="true"> <font> <Font size="15.0" /> </font> </Label> </children> </HBox> <HBox fx:id="homeCenter" alignment="CENTER" fillHeight="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="500" minWidth="800.0"> <children> </children> </HBox> </children> </VBox> </children></AnchorPane>
In questo home ho un bottone che al suo click chiama un metodo del suo controller e carina al centro una nuova pagina fxml:
codice:
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("primaPagina.fxml")); VBox parent = (VBox) fxmlLoader.load(); parent.prefWidthProperty().bind(homeCenter.widthProperty()); homeCenter.getChildren().clear(); homeCenter.getChildren().setAll(parent);
In primaPagina.fxml ho una tabella e proprio qui ho un problema.
Praticamente questa Tableview si adatta soltanto in larghezza, mentre in lunghezza mantiene quella minima che ho impostato:
codice:
<VBox fx:id="primaPagina" alignment="TOP_CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="800.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="PrimaPagina"> <children> <HBox alignment="TOP_CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="515.0" VBox.vgrow="ALWAYS"> <children> <TitledPane animated="false" collapsible="false" minHeight="400.0" text="Prima Pagina" wrapText="true" HBox.hgrow="ALWAYS"> <font> <Font size="12.0" /> </font> <content> <TableView fx:id="tabellaPrimaPagina" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0"> <columns> <TableColumn fx:id="id" text="ID" /> <TableColumn fx:id="nome" text="nome" /> </columns> <columnResizePolicy> <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> </columnResizePolicy> </TableView> </content> </TitledPane> </children> <VBox.margin> <Insets /> </VBox.margin> </HBox> </children></VBox>
Come MaxWidht e MaxHeight ho impostato ovunque MAX_VALUE, ma quando ingrandisco l'applicazione, la tabella mantiene la lunghezza di 400 qualcuno potrebbe aiutarmi?
Grazieee