레이블이 swt인 게시물을 표시합니다. 모든 게시물 표시
레이블이 swt인 게시물을 표시합니다. 모든 게시물 표시

2015년 12월 3일 목요일

WindowsBuilder 설치하기




SWT UI 디자인을 편하게 해주는 툴이당.
http://www.eclipse.org/windowbuilder/download.php 에서 다운로드 경로 확인
Help > Install new software 선택하고 Add 클릭한 다음 위 URL 입력
SWT Designer, WindowsBuilder Engine 체크하고 설치하기

디자인할 자바 파일을 우클릭한 다음 Open With > WindowsBuilder Editor 선택





SWT 개발환경 구축하기



SWT 다운로드
http://www.eclipse.org/swt/

File > Import > General > Existing Projects into Workspace
Select archive file 선택하고 Browser 버튼을 클릭해서 다운받은 파일 지정하고 Finish 클릭

File > New > Java Project 선택하고 기타 정보를 입력한 후 프로젝트 생성
생성한 프로젝트 Properties에서 Java Build Path > Projects 선택하고 Add 버튼 클릭
org.eclipse.swt 체크하고 OK





2013년 2월 12일 화요일

WebSphere wct.sh 실행 시 java.lang.UnsatisfiedLinkError: Could not load SWT library 오류



1. 에러내용
WebSphere wct.sh 실행시 아래와 같은 오류 발생

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
        /.ibm/WebSphere/AppServer/configurations/WCT8/org.eclipse.osgi/bundles/55/1/.cp/libswt-pi-gtk-3659.a (A file or directory in the path name does not exist.)
        swt-pi-gtk (Not found in java.library.path)
        /tmp/swtlib-64/libswt-pi-gtk-3659.a (A file or directory in the path name does not exist.)
        /tmp/swtlib-64/libswt-pi-gtk.a (A file or directory in the path name does not exist.)

2. 해결방안 : 아래 URL을 방문해서 아래 패키지를 모두 설치 후 재실행
http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html

rpm -ivh expat-2.0.1-1.aix5.2.ppc.rpm
rpm -ivh zlib-1.2.3-3.aix5.1.ppc.rpm
rpm -ivh freetype2-2.3.9-1.aix5.2.ppc.rpm
rpm -ivh fontconfig-2.4.2-1.aix5.2.ppc.rpm
rpm -ivh gettext-0.10.40-6.aix5.1.ppc.rpm
rpm -ivh glib2-2.12.4-2.aix5.2.ppc.rpm
rpm -ivh libjpeg-6b-6.aix5.1.ppc.rpm
rpm -ivh libpng-1.2.32-2.aix5.2.ppc.rpm
rpm -ivh libtiff-3.8.2-1.aix5.2.ppc.rpm
rpm -ivh xcursor-1.1.7-3.aix5.2.ppc.rpm
rpm -ivh xft-2.1.6-5.aix5.1.ppc.rpm
rpm -ivh xrender-0.9.1-3.aix5.2.ppc.rpm
rpm -ivh pixman-0.12.0-3.aix5.2.ppc.rpm
rpm -ivh cairo-1.8.8-1.aix5.2.ppc.rpm
rpm -ivh pango-1.14.5-4.aix5.2.ppc.rpm
rpm -ivh atk-1.12.3-2.aix5.2.ppc.rpm
rpm -ivh gtk2-2.10.6-4.aix5.2.ppc.rpm

2011년 8월 2일 화요일

SWT Browser를 이용한 웹페이지 자동 로그인

package org.javaya.test.swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

/**
 * tistory에 접속해서 자동으로 로그인 한다.<br/>
 * SWT Browser 클래스를 이용해서 시스템 기본 웹브라우저로 결과를 출력<br/>
 * 이클립스에서 실행할 경우에는 <Ctrl+F11>로 실행하면 되며, <br/>
 * java app로 실행할 경우에는 SWT관련 jar 파일을 클래스패스에 추가해야 한다. <br/>
 * 서버에서 쿠키값을 받아서 이동하기 위해 http://www.tistory.com/ 으로 접속한 뒤 사용자 페이지로 이동 <br/>
 */
public class ShowTistory {
public String url1 = "http://www.tistory.com/"; // tistory main
public String url2 = "http://???.tistory.com/"; // 로그인 하고자 하는 tistory 주소

Browser browser = null;
Shell shell = null;

/**
* Runs the application
*/
public void run() {
Display display = new Display();
shell = new Shell(display);
shell.setText("Browser");
createContents(shell);
shell.open();

// Navigate to url1
browser.setUrl(url1);

while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}

final void setTitle(String title) {
this.shell.setText(title);
}

final void executeScript(String script) {
browser.execute(script);
}

final void maximize() {
shell.setMaximized(true);
}

/**
* Creates the main window's contents
* @param shell the main window
*/
private void createContents(Shell shell) {
shell.setLayout(new FillLayout());

// Create a web browser
browser = new Browser(shell, SWT.NONE);

browser.addStatusTextListener(new org.eclipse.swt.browser.StatusTextListener()
{
public void changed(org.eclipse.swt.browser.StatusTextEvent e) {
if (e.text.contains("완료")) {}
}
});

browser.addLocationListener(new org.eclipse.swt.browser.LocationListener()
{
public void changed(LocationEvent e) {
setTitle("Teleweb");
executeScript("document.getElementById('loginid').value = '???@daum.net';"); // tistory ID
executeScript("document.getElementById('password').value = '???';"); // tistory password
executeScript("login();");
executeScript("confirm('이동');");
executeScript("document.location.href='" + url2 + "';");
maximize();
browser.removeLocationListener(this);
}

public void changing(LocationEvent e) {
// TODO Auto-generated method stub
}
});

}

/**
* The application entry point
* @param args the command line arguments
*/
public static void main(String[] args) {
new ShowTistory().run();

}
}