Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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? enter image description here

<?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.

like image 895
badarshahzad Avatar asked Sep 07 '25 18:09

badarshahzad


1 Answers

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.

like image 126
badarshahzad Avatar answered Sep 10 '25 01:09

badarshahzad