日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

Ecipse 3.0.1 和VE插件安裝實戰(zhàn)攻略

 fordoc 2006-01-20
Ecipse 3.0.1 和VE插件安裝實戰(zhàn)攻略

 早就聽說Eclipse的鼎鼎大名,瀏覽了好多關(guān)于Eclipse的文章,聽說用SWT,JFace能設計出擁有本地操作系統(tǒng)界面風格的東東,如果在XP上運行,豈不是很讓客戶滿意,近期要做個桌面系統(tǒng),^_^....., 想Trying 下.
用Eclipse當然就要裝上再說,這兩天我是吃勁了苦頭..., 下載了很多東西,讀了很多文章,終于調(diào)通了,現(xiàn)在給大家分享下.我沒有找到完整的安裝攻略,現(xiàn)在就寫一個最新的.....  建議您先瀏覽下Eclipse網(wǎng)站  
http://www.  尤其是 Projects 連接, 其中的Eclipse Projiect, 和 Eclipse Tools Project.
Eclipse (Eclipse SDK 最新的是3.0.2) 是一個平臺,其中的JDT,PDE都是集成在Eclipse下載的,SWT,JFace開發(fā)包也是,不用關(guān)心太多,有些文章說的很多,反而讓新手迷惑...
Eclipse Tool Project 主要用到. Graphical Editor Framework (GEF) Project, EMF, VE  
不要急于下載這些東東,我算是吃勁苦頭......
用Eclipse當然希望用它的可視化編程(Visual Edit Project) 插件. 現(xiàn)在最新的是 VE1.0.2.1下載頁 
http://www./vep/
現(xiàn)看它的下載需求!!!!!  原來VE只能和相應版本的GEF,EMF,Eclipse SDK,一起工作,如果先前你下載了其他的高版本,都糟踐的,關(guān)鍵是耽誤自己的時間.
好了,攻略開始.建個下載文件夾.
下載VE(1.0.2.1)
在同一個頁面的需求里下載 Eclipse SDK 3.0.1, EMF 2.0.1, GEF3.0.1
解壓縮Eclipse SDK 3.0.1, 把解壓縮里的 eclipse 文件夾拷貝到D:\
看看里邊的內(nèi)容,主要是plugins,features
解壓縮 EMF 到\emf 文件夾, 把emf\plugins 的東西都拷貝到d:\eclipse\plugins, emf\features 下的東西拷貝到d:\eclipse\features 
VE,GEF 操作同上...
重要的,Eclipse 3.0.1 需要 JDK1.4.2, 所以要先安裝它.JDK的路徑設置就不再說了.....\bin, \lib , \jdk1.4.2
由于運行SWT的程序用到本地庫,因此拷貝 D:\eclipse\plugins\org.eclipse.swt.win32_3.0.1\os\win32\x86 下的 *.dll 拷貝到 jdk路徑下的 \bin 目錄, 運行程序可以自動找到.  這些問題都困擾了我好長時間.
現(xiàn)在啟動 d:\eclipse\eclipse.exe  
^_^^_^,都OK了
eclipse 能自動認出你的JRE.
實戰(zhàn)!
啟動eclipse,看看welcome project 吧,不錯... 界面很迷人!
新建一個項目 file->New->project 出來項目向?qū)? 選擇java project.  ->next 輸入project Name:Hello  Eclipse自動給你建個workspace 工作文件夾,你的項目都存在這里的,d:\eclipse\workspace  點擊結(jié)束. 一個新項目建成了.
添加SWT ToolKit, 菜單Project->Properties 選擇左側(cè)的 Java Build Path  選擇 右側(cè)的 Libraries 標簽頁, 點擊 Add Library 按鈕, 選擇 Standard Widget Toolkit(SWT)  點擊 Next , 選上 Include support for JFace library  結(jié)束.這樣就可以使用 SWT Jface控件了.
選中你的project Hello. 選擇新建圖標按鈕, 上端最左側(cè)的. 選擇 Visual Class ,點擊Next , Source Folder 是缺省的 project folder, package 填入 test, Name 填入 FrmHello  , 展開左側(cè)的 SWT 選擇 Shell, 勾選上 public static void main(String[] args), Constructors from superclass, Inherited abstract methods. 結(jié)束.
Eclipse自動啟動 VE.... 看看那些窗口... 比較熟悉.. 出現(xiàn)了可視化編輯窗口.
鼠標移到右側(cè)的Palette(豎著的那個)把 一個Label,一個Button, 一個TextArea 放到shell上.
選中Label, 在下側(cè)的Properties屬性欄可以進行設置, >text 填入Hello World
選中 Button 在下側(cè)的Properties屬性欄可以進行設置, >text 填入Click Me.
選中 Button 右鍵, events->Add Events . 選擇Mouse - MouseAdapter ->mouseDown.  相應的代碼自動產(chǎn)生.添加如下代碼(藍色部分)
也可進行其他的風格設置, 但是如果JDK版本不對則不能操作.有錯...
全部代碼:
/*
* Created on 2005-4-20
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package test;

import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
/**
* @author w19284
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class FrmHello {

private org.eclipse.swt.widgets.Shell sShell = null; // @jve:decl-index=0:visual-constraint="41,12"
private Label label = null;
private Button button = null;
private Text textArea = null;
/**

*/
public FrmHello() {
super();
// TODO Auto-generated constructor stub
}

public static void main(String[] args) {
/* Before this is run, be sure to set up the following in the launch configuration 
* (Arguments->VM Arguments) for the correct SWT library path. 
* The following is a windows example:
* -Djava.library.path="installation_directory\plugins\org.eclipse.swt.win32_3.0.0\os\win32\x86"
*/
org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault(); 
FrmHello thisClass = new FrmHello();
thisClass.createSShell() ;
thisClass.sShell.open();

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

/**
* This method initializes sShell
*/
private void createSShell() {
sShell = new org.eclipse.swt.widgets.Shell(); 
label = new Label(sShell, SWT.NONE);
button = new Button(sShell, SWT.NONE);
textArea = new Text(sShell, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
sShell.setText("Shell");
sShell.setBackground(org.eclipse.swt.widgets.Display.getDefault().getSystemColor(org.eclipse.swt.SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
label.setBounds(new org.eclipse.swt.graphics.Rectangle(167,5,96,24));
label.setText("Hello World");
label.setBackground(org.eclipse.swt.widgets.Display.getDefault().getSystemColor(org.eclipse.swt.SWT.COLOR_INFO_BACKGROUND));
label.setFont(new org.eclipse.swt.graphics.Font(org.eclipse.swt.widgets.Display.getDefault(), "Times New Roman", 12, org.eclipse.swt.SWT.BOLD));
button.setBounds(new org.eclipse.swt.graphics.Rectangle(152,34,123,24));
button.setText("Click Me");
button.setFont(new org.eclipse.swt.graphics.Font(org.eclipse.swt.widgets.Display.getDefault(), "Times New Roman", 14, org.eclipse.swt.SWT.NORMAL));
textArea.setBounds(new org.eclipse.swt.graphics.Rectangle(64,70,323,123));
sShell.setSize(new org.eclipse.swt.graphics.Point(451,232));
button.addMouseListener(new org.eclipse.swt.events.MouseAdapter() { 
public void mouseDown(org.eclipse.swt.events.MouseEvent e) { 
System.out.println("mouseDown()"); // TODO Auto-generated Event stub mouseDown()
textArea.setText(textArea.getText() + "|Hello,Eclipse");
}
});
}
}
好了,大功馬上告成.  選擇運行圖標, toolBar 上的綠色按鈕旁邊的黑下箭頭.選擇->run.., 選擇左側(cè)的java Application 點擊下面的新建.  選擇中間Main標簽頁, Project 選擇Hello , Main class: 選擇test.FrmHello.  點擊 run 按鈕. 
界面出來了...., 以后你就可以直接點擊Run圖標,運行這個程序.  點擊Click Me 看看TextArea的變化...

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多