我正在使用scenebuilder,我希望我的应用程序具有横向工具栏和网络视图。我遇到的问题是当我最大化屏幕时,webview 保持相同的大小,而窗格变大。我尝试过 Stackpane,但没有用。现在的结构看起来像这样:
Pane
VBox
StackPane
WebView
编辑:我尝试了其他的东西,例如这让我调整大小但堆栈面板填满了整个屏幕,没有地方放置 vBox
AnchorPane
VBox
StackPane
WebView
我的 fxml
<AnchorPane fx:id="anchor" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.BrowserController">
<children>
<VBox fx:id="vbox" prefHeight="600.0" prefWidth="200.0" style="-fx-background-color: red;" />
<StackPane fx:id="subPane" alignment="CENTER_RIGHT" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<WebView fx:id="webview" prefWidth="600.0" />
</children>
</StackPane>
</children>
</AnchorPane>
相关分类