SWT 개발준비
1. SWT란?
SWT란 표준 위젯 툴킷(Standard Widget Toolkit)의 줄임말로 이클립스에서 사용하고 있는 자바기반의 위젯 툴킷(Widget Toolkit)입니다. SWT와 JFace를 툴이나 툴셋이라고 말하기도 하지만, SWT/JFace는 본질적으로 소프트웨어 라이브러리입니다.
2. 이클립스 설치하기
2-1. 이클립스 다운로드
이클립스는 WindowBuilder Pro와 맞추기 위해 Eclipse RCP Indigo를 선택했습니다. 아래의 "Eclipse 다운로드" 링크를 클릭하면 이클립스 다운로드 페이지로 이동합니다.
Eclipse 다운로드
2-2. 설치파일 다운로드

2-3. 압축풀고 설치
이클립스는 설치형이 아니라 압축파일 형태로 다운로드된 압축파일을 풀면 설치가 완료됩니다.
3. WindowBuilder Pro 설치하기
WindowBuilder Pro는 Swing, SWT, RCP, XWT, GWT 를 쉽게 개발하기 위해 Google에서 제공하는 사용자 인터페이스 개발 툴입니다. 이것을 사용하여 이클립스에서 좀더 쉽게 GUI 프로그램을 만들 수 있습니다. 아래의 순서를 통해 WindowBuilder Pro를 설치합니다.
3-1. WindowBuilder Pro 업데이트 정보 확인

업데이트 URL 정보
http://dl.google.com/eclipse/inst/d2wbpro/latest/3.7

3-3. 이클립스에서 URL정보 설정
이클립스의 Install 창에서 Work with 에 3-1에서 확인한 업데이트 URL을 입력하면, 4가지의 선택목록이 나타납니다. 그 중에서 SWT Designer 와 WindowBuilder Engine을 선택하고 Next > 를 누릅니다.

3-5. 라이센스를 동의(I accept …) 를 누르고 Finish.

3-6. 설치중


4. SWT/JFace 프로젝트 테스트
4-1. 프로젝트를 생성.

4-2. WindowBuilder 의 SWT/JFace Java Project를 선택.

4-3. 프로젝트 이름을 입력하고 Finish.

프로젝트가 생성되고, Referenced Libraries를 보면…필요한 라이브러리들이 자동으로 추가되어 있습니다.

4-4. 기본 윈도우 생성


만들어진 클래스를 보면 기본적인 코드가 입력되어 있습니다.

4-6. Application 실행하기


SWT/JFace를 처음 시작할 때, 기본 서적으로 코딩을 연습하며 구현해도 되지만, 위와 같이 관련 도구를 이용하여 개발하면, 코딩 시간을 훨씬 줄일 수 있습니다. 하지만, 관련된 기능을 제대로 알지 못한다면, 도구만 사용할줄 안다고 해서 응용 프로그램을 만들 수 없기 때문에, 관련 기능들에 대한 지식 습득을 병행하면서 사용하면 개발하는 데 더 쉬울 것이라는 생각이 듭니다.
참고 :자바 개발환경 - SWT/JFace[Eclipse] SWT Maven Project Setting
Eclipse Wiki JFace
5. SWT/JFace 라이브러리 설치하기
위의 WindowBuilder Pro를 사용하면 라이브러리 설치를 별도로 할 필요가 없게되어, 사용하지 않는 경우는 아래의 방법으로 설정할 수 있습니다.
5-1. SWT 다운로드







5-3. SWT 라이브러리 추가하기

Java Build Path에서 Libraries 탭을 선택하여 [Add Variable...]를 클릭합니다.

Extend를 클릭합니다.

plugins을 클릭하면 목록이 아래로 나옵니다.
목록에서 아래의 라이브러리들을 추가합니다.
org.eclipse.core.boot_3.1.200.v20100505.jar
org.eclipse.core.commands_3.6.0.I20110111-0800.jar
org.eclipse.core.runtime_3.7.0.v20110110.jar
org.eclipse.equinox.common_3.6.0.v20110523.jar
org.eclipse.jface.text_3.7.2.v20111213-1208.jar
org.eclipse.jface_3.7.0.v20110928-1505.jar
org.eclipse.osgi_3.7.2.v20120110-1415.jar
org.eclipse.text_3.5.101.v20110928-1504.jar
org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar


5-4. 라이브러리 소스(Source) 추가하기
JFace에 필요한 라이브러리들이 추가됬음을 확인하면, 이클립스 plugins에 라이브러리 소스(Source)도 함께 추가합니다.
5-4-1. org.eclipse.core.commands_3.6.0.I20110111-0800.jar 소스 확장하기
(소스는 있는 것만 확장합니다.)
소스를 추가할 라이브러리를 선택하여 아래 목록에서 Source attachment(None) 을 선택하고 Edit를 누릅니다.

Location variable path가 비어있으면 Variable 을 선택합니다.

Variable 목록에서 ECLIPSE_HOME을 선택하고 OK를 누릅니다.

Location variable path 가 설정되면 소스를 확장하기 위해 Extension….을 누릅니다.

확장할 소스를 선택하고 OK를 누릅니다.

Location variable path에 소스경로까지 함께 확인되면, OK를 눌러 확장되었는지 확인합니다.


5-4-1.과 같은 방법으로 아래의 라이브러리 소스도 확장합니다.
org.eclipse.core.runtime_3.7.0.v20110110.jar
org.eclipse.equinox.common_3.6.0.v20110523.jar
org.eclipse.jface.text_3.7.2.v20111213-1208.jar
org.eclipse.jface_3.7.0.v20110928-1505.jar
org.eclipse.osgi_3.7.2.v20120110-1415.jar
org.eclipse.text_3.5.101.v20110928-1504.jar
org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar
마지막에 소스코드 어태치하는부분에서 해당 소스코드파일이 존재하지 않습니다. 직접 다운받아야 하는 부분인가요?? 이클립스 mar버전이고 그외 파일들은 최신으로 이클립스홈페이지에 직접 받았습니다.
답글삭제