3个使用javafx的响应性盒子设计

3个使用javafx的响应性盒子设计,javafx,fxml,scenebuilder,Javafx,Fxml,Scenebuilder,如何使用scenebuilder为javafx创建树响应的方框设计。它应该有3个框,可以根据屏幕大小进行调整。类似于下面的框。任何帮助> 我不使用scenebuilder,我更喜欢自己创建FXML文件,尤其是因为它没有响应性。 定义应用程序UI的目的是选择好的布局。根据你想要达到的目标,有些人比其他人反应更快 我看到了你的第一篇文章,我没有使用JFoenix,然后这里有一个非常轻巧/简单的例子,带有“常规”组件,可以帮助你使应用程序响应迅速 <?xml version="1.0" enco

如何使用scenebuilder为javafx创建树响应的方框设计。它应该有3个框,可以根据屏幕大小进行调整。类似于下面的框。任何帮助>


我不使用scenebuilder,我更喜欢自己创建FXML文件,尤其是因为它没有响应性。
定义应用程序UI的目的是选择好的布局。根据你想要达到的目标,有些人比其他人反应更快

我看到了你的第一篇文章,我没有使用JFoenix,然后这里有一个非常轻巧/简单的例子,带有“常规”组件,可以帮助你使应用程序响应迅速

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

<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>

<fx:root xmlns:fx="http://javafx.com/fxml/1" type="GridPane" >
    <children>
        <VBox GridPane.rowIndex="0" GridPane.columnIndex="0" style="-fx-background-color:grey; -fx-opacity:0.7;"/>
        <VBox GridPane.rowIndex="0" GridPane.columnIndex="2" style="-fx-background-color:grey; -fx-opacity:0.7;"/>
        <VBox GridPane.rowIndex="0" GridPane.columnIndex="4" style="-fx-background-color:grey; -fx-opacity:0.7;"/>

        <HBox GridPane.rowIndex="1" GridPane.columnIndex="2"  alignment="CENTER" spacing="10.0">
            <Button text="ADD" style="-fx-background-color:DODGERBLUE;-fx-border-radius:10;-fx-background-radius:10"/> 
            <Button text="UPDATE" style="-fx-background-color:DODGERBLUE;-fx-border-radius:10;-fx-background-radius:10"/>
            <Button text="CLEAN" style="-fx-background-color:DODGERBLUE;-fx-border-radius:10;-fx-background-radius:10"/>
        </HBox>
    </children>
    <columnConstraints>
        <ColumnConstraints percentWidth="30.0" />
        <!-- Space -->
        <ColumnConstraints percentWidth="5.0" />
        <ColumnConstraints percentWidth="30.0" />
        <!-- Space -->
        <ColumnConstraints percentWidth="5.0" />
        <ColumnConstraints percentWidth="30.0" />
    </columnConstraints>
    <rowConstraints>
        <RowConstraints percentHeight="80.0" />
        <RowConstraints percentHeight="20.0" />
    </rowConstraints>
    <padding>
        <Insets top="10.0" left="10.0" bottom="10.0" right="10.0"/>
    </padding>
</fx:root>

这会导致类似的情况:

我不使用scenebuilder,我更喜欢自己创建FXML文件,尤其是因为它没有响应性。
定义应用程序UI的目的是选择好的布局。根据你想要达到的目标,有些人比其他人反应更快

我看到了你的第一篇文章,我没有使用JFoenix,然后这里有一个非常轻巧/简单的例子,带有“常规”组件,可以帮助你使应用程序响应迅速

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

<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>

<fx:root xmlns:fx="http://javafx.com/fxml/1" type="GridPane" >
    <children>
        <VBox GridPane.rowIndex="0" GridPane.columnIndex="0" style="-fx-background-color:grey; -fx-opacity:0.7;"/>
        <VBox GridPane.rowIndex="0" GridPane.columnIndex="2" style="-fx-background-color:grey; -fx-opacity:0.7;"/>
        <VBox GridPane.rowIndex="0" GridPane.columnIndex="4" style="-fx-background-color:grey; -fx-opacity:0.7;"/>

        <HBox GridPane.rowIndex="1" GridPane.columnIndex="2"  alignment="CENTER" spacing="10.0">
            <Button text="ADD" style="-fx-background-color:DODGERBLUE;-fx-border-radius:10;-fx-background-radius:10"/> 
            <Button text="UPDATE" style="-fx-background-color:DODGERBLUE;-fx-border-radius:10;-fx-background-radius:10"/>
            <Button text="CLEAN" style="-fx-background-color:DODGERBLUE;-fx-border-radius:10;-fx-background-radius:10"/>
        </HBox>
    </children>
    <columnConstraints>
        <ColumnConstraints percentWidth="30.0" />
        <!-- Space -->
        <ColumnConstraints percentWidth="5.0" />
        <ColumnConstraints percentWidth="30.0" />
        <!-- Space -->
        <ColumnConstraints percentWidth="5.0" />
        <ColumnConstraints percentWidth="30.0" />
    </columnConstraints>
    <rowConstraints>
        <RowConstraints percentHeight="80.0" />
        <RowConstraints percentHeight="20.0" />
    </rowConstraints>
    <padding>
        <Insets top="10.0" left="10.0" bottom="10.0" right="10.0"/>
    </padding>
</fx:root>

这会导致类似的情况:

您好,我刚刚使用GridPane完成了布局,然后看到了您的答案。非常感谢你的回答。我想gridpane真的是一个不错的选择,呵呵。不过,你没有理由不能用场景生成器来实现这一点。具体取决于您希望它如何响应调整大小,
HBox
也可以在这里工作。(或者,我猜,
BorderPane
带有
HBox
,中间有三个
VBox
,底部有一个
HBox
中的三个按钮。)@James_D我不知道第一句话是否适合我,但如果是的话,我绝对不会说这对SceneBuilder不起作用。。。我的观点是SceneBuilder经常设置许多硬编码的坐标/组件大小,这就是为什么GUI在大多数情况下响应性不如手动FXML编写的原因。您好,我刚刚使用GridPane完成了布局,然后我看到了您的答案。非常感谢你的回答。我想gridpane真的是一个不错的选择,呵呵。不过,你没有理由不能用场景生成器来实现这一点。具体取决于您希望它如何响应调整大小,
HBox
也可以在这里工作。(或者,我猜,
BorderPane
带有
HBox
,中间有三个
VBox
,底部有一个
HBox
中的三个按钮。)@James_D我不知道第一句话是否适合我,但如果是的话,我绝对不会说这对SceneBuilder不起作用。。。我的观点是SceneBuilder经常设置许多硬编码的坐标/组件大小,这就是为什么GUI在大多数情况下对它的响应不如手动FXML编写。