Search

Stage

Stage

ํ”„๋กœ๊ทธ๋žจ์˜ย ์ตœ์ƒ์œ„ ์œˆ๋„์šฐ

๊ตฌ์„ฑ์š”์†Œ

โ€ข
๋ฉ”๋‰ด
โ€ข
๋„๊ตฌ๋ชจ์Œ
โ€ข
์ƒํƒœ ํ‘œ์‹œ์ค„
โ€ข
์—ฌ๋Ÿฌ ๊ฐœ์˜ Scene
ํ•˜๋‚˜์˜ ์ธ์Šคํ„ด์Šค๋งŒ ์กด์žฌํ•˜๊ณ , ํ”„๋กœ๊ทธ๋žจ์ด ์‹คํ–‰๋  ๋•Œ, ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

์˜ˆ์‹œ์ฝ”๋“œ

Main.java

package application; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.input.KeyCombination; import javafx.scene.paint.Color; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { // Stage ๊ฐ์ฒด ์ƒ์„ฑ // Stage stage = new Stage(); // Scene์— ์ถ”๊ฐ€ํ•  ๋ฃจํŠธ ๊ทธ๋ฃน ์ƒ์„ฑ Group root = new Group(); // Scene ์ƒ์„ฑ // ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ๋ฃจํŠธ ๊ทธ๋ฃน๊ณผ ๋ฐฐ๊ฒฝ์ƒ‰ ์ง€์ • Scene scene = new Scene(root, Color.BLACK); // ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์•„์ด์ฝ˜ ์„ค์ • Image icon = new Image("icon.png"); stage.getIcons().add(icon); // ์œˆ๋„์šฐ ํƒ€์ดํ‹€ ์„ค์ • stage.setTitle("ํ”„๋กœ๊ทธ๋žจ ์ œ๋ชฉ"); // ์œˆ๋„์šฐ ํฌ๊ธฐ ์„ค์ • stage.setWidth(420); stage.setHeight(420); // ์œˆ๋„์šฐ ํฌ๊ธฐ ์กฐ์ ˆ ๊ฐ€๋Šฅ ์—ฌ๋ถ€ ์„ค์ • stage.setResizable(false); // ์œˆ๋„์šฐ ์œ„์น˜ ์„ค์ • (์„ ํƒ์ ) // stage.setX(50); // stage.setY(50); // ์ „์ฒด ํ™”๋ฉด ๋ชจ๋“œ ์„ค์ • stage.setFullScreen(true); // ์ „์ฒด ํ™”๋ฉด ๋ชจ๋“œ ์ข…๋ฃŒ ํžŒํŠธ ์„ค์ • stage.setFullScreenExitHint("์ „์ฒด ํ™”๋ฉด ์ข…๋ฃŒ (Q)"); // ์ „์ฒด ํ™”๋ฉด ๋ชจ๋“œ ์ข…๋ฃŒ ๋‹จ์ถ•ํ‚ค ์„ค์ • stage.setFullScreenExitKeyCombination(KeyCombination.valueOf("Q")); // Scene์„ Stage์— ์„ค์ • stage.setScene(scene); // Stage ๋ณด์ด๊ธฐ stage.show(); } }
Java
๋ณต์‚ฌ