Swt J Face 1주차

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

3 comments

Comments 1 - 3 of 3 previous next Post a comment

Post a comment
Embed Video
Edit your comment Cancel

Favorites, Groups & Events

Swt J Face 1주차 - Presentation Transcript

  1. SWT에 대해 조현종(2009/01/20) http://cafe.naver.com/eclipseplugin http://hangumkj.blogspot.com/ hangum@gmail.com
  2. 목차 SWT는? Hello World 예제 SWT Designer 소개-- SWT 주요 Package 소개 Dialog 소개 Widget 소개 Event 소개 Layout 소개 팀 만들기-- 실습 참고자료
  3. SWT는? SWT?(Standard Widget Toolkit) 2001년도 발표. CPL(Common Public License) 라이선스 소스코드의 변경, 상업적 이용 모두 무료 OS에 최적화 된 native library 제공(JNI Windows, Linux, Unix, Mac OS www.eclipse.org/swt
  4. Hello World 예제? public static void main(String args[]) { Display display = new Display(); // 1 Shell shell = new Shell(display); // 2 shell.setText(\"Hello World\"); // 3 shell.setSize(300, 300); // 4 shell.open(); // 5 while (!shell.isDisposed()) // 6 if (!display.readAndDispatch()) // 7 display.sleep(); // 8 display.dispose(); // 9 }
  5. Hello World 예제? Widget/Control/Composite Shell Class Display SWT OS Class, JNI 1. Display? System OS 1. GUI 상태를 유지해주고 OS와 통신 2. Event에 대한 처리 및 관련된 곳에 전달 3. System 상수 정의. 2. Shell? 1. GUI의 최상의 윈도우 2. 시각적인 부분을 구현(Container, Widget, event와 GUI를 연동하기 위한 연결고리)
  6. Hello World 예제? 3. Shell의 Title를 ‘Hello World’로 설정 4. Shell Size를 300, 300으로 설정 5. Shell을 오픈한다. 6. Shell이 종료 되지 않았으면 7. System event를 읽어서 관련 event전달 8. Event가 있을때까지 sleep 9. Display를 종료하고 프로그램을 종료한다.
  7. Hello World 예제? 작업환경? 1. Eclipse 3.4 (SWT 3. 4) 2. Java Project 생성 classpath 설정 (plugin\\org.eclipse.swt.win32.win32.x86_3.4.0.v3448f.jar
  8. SWT 주요 Package소개 기능 Package명 상수와 예외값들이 정의 org.eclipse.swt SWT, SWTException, SWTError Wedget, Component 및 관련 Interface org.eclipse.swt.widgets 이벤트, 리스너, 이벤트 타입정의 org.eclipse.swt.events Drag and Drop 정의 org.eclipse.swt.dnd Layout 정의 org.eclipse.swt.layout 그래픽관련 정의 org.eclipse.swt.graphics 전체 약 200개의 class로 구성
  9. Dialog 소개 Object Dialog ColorDialog DirectoryDialog FileDialog FontDialog MessageDialog PrintDialog
  10. Dialog 소개 ColorDialog? ColorDialog dlg = new ColorDialog(shell); dlg.setRGB(colorLabel.getBackground().getRGB()); dlg.setText(\"Choose a Color\"); RGB rgb = dlg.open(); if (rgb != null) { …… } DirectoryDialog? DirectoryDialog dlg = new DirectoryDialog(shell); dlg.setFilterPath(text.getText()); dlg.setText(\"SWT's DirectoryDialog\"); dlg.setMessage(\"Select a directory\"); String dir = dlg.open(); if (dir != null) { … }
  11. Dialog 소개 FileDialog? FileDialog fd = new FileDialog(s, SWT.OPEN); fd.setText(\"Open\"); fd.setFilterPath(\"C:/\"); String[] filterExt = { \"*.txt\", \"*.doc\", \".rtf\", \"*.*\" }; fd.setFilterExtensions(filterExt); String selected = fd.open(); FontDialog? FontDialog fd = new FontDialog(s, SWT.NONE); fd.setText(\"Select Font\"); fd.setRGB(new RGB(0, 0, 255)); FontData defaultFont = new FontData (\"Courier\", 10, SWT.BOLD); fd.setFontData(defaultFont); FontData newFont = fd.open(); if (newFont != null) { …. }
  12. Dialog 소개 MessageDialog? MessageBox messageBox = new MessageBox (shell, SWT.OK | SWT.CANCEL | SWT. ICON_WARNING); messageBox.setText(\"Hello, World\"); messageBox.setMessage(\"Hello, World\"); messageBox.open(); PrintDialog? PrintDialog printDialog = new PrintDialog(s, SWT. NONE); printDialog.setText(\"Print\"); PrinterData printerData = printDialog.open();
  13. Widget 소개
  14. Widget 소개
  15. Widget 소개
  16. Widget 소개
  17. Widget 소개
  18. Event 소개 운영체제 최상위 Object Display Event Shell EventObject Queue 메시지 SWTEventObject DragSourceEvent DragTargetEvent 이벤트 focusEvent HelpEvent KeyEvent Widjet Listener Interface ModifyEvent 이벤트 MouseEvent SelectionEvent TextChangedEvent 호출 Event 호출 메소드
  19. Layout 소개 영역을 나누는 방식 FillLayout, RowLayout, GridLayout 콘트롤을 붙이는 방식 FormLayout 한번에 하나의 콘트롤 StackLayout 보여지는 방식
  20. Layout 소개 FillLayout shell.setLayout(new FillLayout(SWT.VERTICAL)); shell.setLayout(new FillLayout());
  21. Layout 소개 RowLayout shell.setLayout(new RowLayout());
  22. Layout 소개 GridLayout final Shell shell = new Shell(); final GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; shell.setLayout(gridLayout);
  23. Layout 소개 shell.setLayout (new FormLayout();); Button button1 = new Button(shell, SWT.PUSH); Button button2 = new Button(shell, SWT.PUSH); Button button3 = new Button(shell, SWT.PUSH); FormLayout button1.setText(\"B1\"); button2.setText(\"B2\"); button3.setText(\"B3\"); FormData data1 = new FormData(); data1.left = new FormAttachment(0,5); data1.right = new FormAttachment(25,0); button1.setLayoutData(data1); FormData data2 = new FormData(); data2.left = new FormAttachment(button1,5); data2.right = new FormAttachment(90,-5); button2.setLayoutData(data2); FormData data3 = new FormData(); data3.top = new FormAttachment(button2,5); data3.bottom = new FormAttachment(100,-5); data3.right = new FormAttachment(100,-5); data3.left = new FormAttachment(25,5); button3.setLayoutData(data3);
  24. Layout 소개 StackLayout?
  25. 실습 초기화면이 로드되면 아래의 예제 데이터가 로드 된다 . 이름에 값을 입력하고 검색 버튼을 누르면 이름으로 테이블에 있는 데이터를 검색하고 데이터가 있다면 선택한다 아래 선택 버튼을 클릭하면 선택팝업이 뜨면서 상세정보출력한다 예제데이터 이름 ,나이 ,전화번호 ,주소 톰,47,010-1234-1235, (cvs) 미국헐리우드 제리 ,48,010-1234-1234,한국 놀부 ,500,02-1234-1231,한국
  26. 참고자료 http://www.eclipse.org/swt http://www.cs.umanitoba.ca/~eclipse/ http://www.joinc.co.kr/modules/moniwiki/wiki. php/Site/eclipse/documents/SWT http://www.ibm.com/developerworks/kr/library/os-swingswt/ http://www.developer.com/java/other/article.php/3340621 http://www.developer.com/design/article.php/10925_3330861_1 http://www.eclipse.org/nebula/
SlideShare Zeitgeist 2009

+ cho hyun jongcho hyun jong Nominate

custom

632 views, 0 favs, 1 embeds more stats

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 632
    • 591 on SlideShare
    • 41 from embeds
  • Comments 3
  • Favorites 0
  • Downloads 32
Most viewed embeds
  • 41 views on http://hangumkj.blogspot.com

more

All embeds
  • 41 views on http://hangumkj.blogspot.com

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories