简体   繁体   中英

How to set auto resize when window size increase in javafx?

When i resize window the hbox size is fix and that's why is not increasing when i increase the size of window. How to auto resize or set to the window size whenever user increase the size of window? 在此处输入图片说明

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

<?import com.jfoenix.controls.JFXHamburger?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <HBox layoutX="-6.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="100.0" prefWidth="807.0" style="-fx-background-color: #42A5F5;">
         <children>
            <JFXHamburger prefHeight="100.0" prefWidth="100.0" />
         </children>
      </HBox>
   </children>
</AnchorPane>

Please give me suggestion how to build a better UI in javafx give me sources if you know.

Simply, after 1 and half year I learn how to make flexible and dynamic UI design in Javafx.

  1. Use BorderPane as a root pane.
  2. Put your HBox in BorderPane top. (Use computer size width and height)

This is just one way you could find multiple ways of dynamic UI example on stack or google.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM