FlowPane 컨테이너
: 행으로 컨트롤를 배치
: 공간이 부족하면 새로운 행에 배치
FlowPane 컨테이너
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<FlowPane xmlns:fx="http://javafx.com/fxml"
prefWidth="300.0" prefHeight="70.0" hgap="10.0" vgap="10.0"> <!-- hgap : 수평간격 / vgap : 수직간격 -->
<padding>
<Insets top="10.0" right="10.0" bottom="10.0" left="10.0" />
</padding>
<children>
<Button text = "Button" />
<Button text = "Button" />
<Button text = "Button" />
<Button text = "Button" />
<Button text = "Button" />
<Button text = "Button" />
</children>
</FlowPane>
FlowPane 컨테이너 실행
package sec04.exam04_flowpane;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class AppMain extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("root.fxml"));
Scene scene = new Scene(root);
primaryStage.setTitle("AppMain");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
'Java > 17. JavaFX' 카테고리의 다른 글
Day 26 : JavaFX 컨테이너 - GridPane 컨테이너 (0) | 2021.11.23 |
---|---|
Day 26 : JavaFX 컨테이너 - TilePane 컨테이너 (0) | 2021.11.23 |
Day 25 : JavaFX 컨테이너 - BorderPane 컨테이너 (0) | 2021.11.23 |
Day 25 : JavaFX 컨테이너 - HBox와 VBox 컨테이너 (0) | 2021.11.23 |
Day 25 : JavaFX 컨테이너 - AnchorPane 컨테이너 (0) | 2021.11.23 |