Recent Posts
Recent Comments
Link
06-30 12:53
Today
Total
관리 메뉴

삶 가운데 남긴 기록 AACII.TISTORY.COM

[SWT/JFace] 이클립스 플러그인 개발 환경 설정 본문

DEV&OPS/Java

[SWT/JFace] 이클립스 플러그인 개발 환경 설정

ALEPH.GEM 2024. 1. 16. 21:22

윈도우즈 환경에서 이클립스 플러그인 SWT/JFace 개발을 위한 환경 설정을 해보겠습니다.

 

JDK 설치

여기서는 JDK11 을 기준으로 합니다. 다운로드 및 설치는 OpenJDK나 오라클에서 하시면 됩니다.

https://openjdk.org/

 

OpenJDK

Learn about the key active Projects in the Community including Amber (high-productivity language features), Loom (lightweight concurrency), Panama (foreign functions and foreign data), Valhalla (primitive types and specialized generics), and, of course, th

openjdk.org

https://www.oracle.com/kr/java/technologies/javase/jdk11-archive-downloads.html

 

Java Archive Downloads - Java SE 11 | Oracle 대한민국

WARNING: These older versions of the JRE and JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production. For production use Oracle recommends downlo

www.oracle.com

 

이클립스 설치

이클립스는 전자정부프레임워크 개발환경이나 STS를 사용해도 무방합니다.

다만 너무 최신 버전 보다 2~3년전 버전으로 하는 것이 좋습니다.

최신 버전은 JRE문제나 라이브러리 호환 문제 때문에 문제가 생길 가능성이 높습니다.

그래서 구버전 이클립스를 쓰는 전자정부프레임워크를 추천합니다.

https://www.egovframe.go.kr/home/sub.do?menuNo=94

 

개발환경 - 4.x 다운로드 | 표준프레임워크 포털 eGovFrame

처리중입니다. 잠시만 기다려주십시오.

www.egovframe.go.kr

https://www.eclipse.org/

 

The Community for Open Collaboration and Innovation | The Eclipse Foundation

The Eclipse Foundation provides our global community of individuals and organizations with a mature, scalable, and business-friendly environment for open source …

www.eclipse.org

 

 

Market place WindowBuilder 플러그인 설치

market place에서 WindowBuilder 라는 플러그인을 찾아 설치해줍니다.

이 플러그인은 swt/jface에 의존성이 있기 때문에 설치 시 swt/jface 라이브러리도 같이 설치가 됩니다.

검색해보면 라이브러리를 일일이 추가해 주는 옛날 자료들이 나올 수 있는데... 편하게 WindowBuilder를 설치하시길 추천드립니다.

WindowBuilder 플러그인이 최신 버전 이클립스를 지원하지 않을 수 있음을 유의하십시오.

 

 

SWT 프로젝트 생성

이클립스를 열고 File -> New -> Project를 클릭해줍니다.

그러면 WindowBuilder 항목 -> SWT Designer ->  SWT/JFace Java Project를 선택해서 next 버튼을 누릅니다.

 프로젝트 이름과 JRE를 선택하고 Finish 버튼을 눌러 프로젝트를 생성해줍니다.

 

다시 File -> New -> Other 를 선택해줍니다.

이번에는 클래스 종류를 선택해줘야 하는데...

WindowBuilder -> SWT Designer -> SWT -> Application Window를 선택하고 Next 버튼을 누릅니다.

이제 새로 생성할 SWT Application의 클래스 이름(예: HelloSWT)을 입력해주고 Finish 버튼을 누릅니다.

 

자 이제 프로젝트를 시작할 수 있습니다.

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class HelloSWT {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		
		Text helloText = new Text(shell, SWT.CENTER);
		helloText.setText("Hello SWT");
		helloText.pack();
		shell.pack();
		shell.open();
		while(!shell.isDisposed()) {
			if(!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}

}

실행은 Run -> Run as -> Java Application으로 실행하시면 됩니다.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

728x90