小编Moh*_*ani的帖子

调整大小时如何使 flowpane 滚动

我想在调整窗口大小以能够看到所有矩形时自动显示滚动条

调整大小前:
调整大小前

调整大小后:
调整大小后

在底部,矩形消失了,但它们仍然存在。那么有没有办法将 Flowpane 与 Scrollpane 结合起来?

我正在使用 SceneBuilder,这是 fxml 代码:

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

<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.shape.Rectangle?>


<FlowPane alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="200.0" stroke="BLACK" strokeType="INSIDE" width="200.0" />
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="200.0" stroke="BLACK" strokeType="INSIDE" width="200.0" />
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="200.0" stroke="BLACK" strokeType="INSIDE" width="200.0" />
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="200.0" stroke="BLACK" strokeType="INSIDE" width="200.0" />
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="200.0" stroke="BLACK" strokeType="INSIDE" width="200.0" />
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="200.0" …
Run Code Online (Sandbox Code Playgroud)

scroll scenebuilder flowpane javafx-8

4
推荐指数
1
解决办法
1856
查看次数

标签 统计

flowpane ×1

javafx-8 ×1

scenebuilder ×1

scroll ×1