3.2.13GridPaneの利用
コントロール類を縦横に綺麗に整列して配置したい場合に用いられるのがGridPaneです。これは、ペイン全体を格子状に切り分け、それぞれの部分にコントロールをはめ込んで表示します。
これも、実物を見たほうが早いでしょう。
<GridPane prefHeight="150.0" prefWidth="300.0"
xmlns="http://javafx.com/javafx/8"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="jp.tuyano.eclipsebook.WindowController">
<Button text="Button1"
GridPane.columnIndex="0" GridPane.rowIndex="0"/>
<Button text="Button2"
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Button text="Button3"
GridPane.columnIndex="2" GridPane.rowIndex="2"/>
</GridPane>
この記事は会員限定です。会員登録をすると続きをお読みいただけます。
ログイン / 新規登録