package application;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class StackPanes2 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Label label = new Label("이미지");
label.setFont(new Font(40));
BorderPane bp = new BorderPane();
bp.setBottom(label);
// ImageView
// - 생성자를 통해 경로를 전달하여 이미지를 불러올 수 있다.
// - 경로 전달시에 상대경로로 전달한다.
ImageView iv = new ImageView("/img/images.jpg");
StackPane stack = new StackPane();
stack.getChildren().addAll(iv, bp);
primaryStage.setScene(new Scene(stack, 300, 300));
primaryStage.show();
}
}
'GUI( JavaFX Scene Builder ) > Layout' 카테고리의 다른 글
HBox, VBox 병합 예제(2) (0) | 2022.08.17 |
---|---|
HBox, VBox 병합 예제(1) (0) | 2022.08.17 |
StackPane (0) | 2022.08.16 |
VBox (0) | 2022.08.15 |
HBox (0) | 2022.08.15 |