[ JAVA ] JavaFX 환경구축 과 프로젝트 생성
세세한 설명없이 굵직굵직 한 내용만 정리.
1. 이클립스 다운 및 설치 https://www.eclipse.org/
The Platform for Open Innovation and Collaboration | The Eclipse Foundation
The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 350 open source projects, including runtimes, tools and frameworks.
www.eclipse.org
2. 다운받은 파일 eclipse-inst-win64.exe 설치 (Enterprise Java Developers)
3. Help-Eclipse Marketplace...에서 Find에 e(fx)clipse 로 검색 ... Install
4. 그래픽 디자이너 SceneBuilder 다운로드&설치
https://gluonhq.com/products/scene-builder/
Scene Builder - Gluon
Drag & Drop,Rapid Application Development. Download Now Integrated Scene Builder works with the JavaFX ecosystem – official controls, community projects, and Gluon offerings including Gluon Mobile, Gluon Desktop, and Gluon CloudLink. Simple Drag & Drop
gluonhq.com
5. eclipse 와 SceneBuilder 연동
6. 프로젝트 생성
7. 이클립스에서 SceneBuilder 툴열기
8. Label 화면 작업...
HelloWorld.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.BorderPane?>
<BorderPane prefHeight="400.0" prefWidth="400.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="application.HelloWorldController">
<top>
<Label text="Hello World OK!" BorderPane.alignment="CENTER">
<font>
<Font size="24.0" />
</font>
</Label>
</top>
</BorderPane>
Main.java
package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("HelloWorld.fxml"));
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
HelloWorldController.java
package application;
public class HelloWorldController {
}
[또다른 블로그 참조]
https://m.blog.naver.com/PostView.nhn?blogId=yeona0314&logNo=220775863028&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2F
[JavaFX] 프로젝트 생성 및 버튼 구현
1. eclipse를 실행합니다. 2. 오른쪽 상단의 File > New > Java Project를 선택하여 Java Proj...
blog.naver.com