ECLIPSE swt实例

SWT示例

SWT示例

%0SAI@C_4RF06RH1WT2@64K.png

SWT示例是用SWT编写的有用的小程序。这些通常比SWT Snippets更大,更全面。

Vista上的ControlExample
  • ControlExample
  • CustomControlExample
  • 地址簿
  • BrowserExample
  • ClipboardExample
  • DNDExample(拖放)
  • FileViewer
  • GraphicsExample
  • HelloWorld [1-5]
  • HoverHelp
  • ImageAnalyzer
  • JavaViewer
  • LayoutExample
  • PaintExample
  • 文本编辑器
  • OLEExample(仅限win32,OLE)
  • OleWebBrowser(仅限win32,OLE)

ControlExample,CustomControlExample,LayoutExample和PaintExample也可用作Eclipse插件,以下示例作为Eclipse插件提供:

  • org.eclipse.swt.examples.browser.demos项目中的BrowserDemo
  • org.eclipse.swt.examples.browser项目中的WebBrowser

有几种方法可以下载和运行SWT示例:

在Eclipse中运行SWT示例

  1. 要获取示例,请访问 http://download.eclipse.org/eclipse/downloads上的Eclipse下载页面。
  2. 单击您想要示例的Eclipse构建(即您正在运行的Eclipse构建;通常是最新的Stable构建)。
  3. 向下滚动,直到看到“示例插件”。阅读有关安装它们的段落,并选择适合您平台的下载。
  4. 安装示例后,您可以在其中找到它们的源代码eclipse/plugins/org.eclipse.swt.examples.<exampleName>.source_<version>.jar
  5. 要运行插件SWT示例,请重新启动Eclipse,转到Window> Show View ...> Other ...并展开“SWT示例”。

或者,您可以使用Eclipse ISV doc中的这些(更详细的)步骤来下载,安装和运行Eclipse SWT示例:

  1. 安装示例
  2. 将SWT示例作为视图或使用SWT示例启动器运行
  3. 运行SWT独立示例
  4. SWT示例概述

在Eclipse中启动独立的SWT示例

  1. 将SWT加载到工作区中。
  2. 通过上面列出的方法之一将SWT示例加载到工作区中
  3. 通过选择主类(例如org.eclipse.swt.examples.controlexample.ControlExample)并且选择运行独立示例运行>运行方式> Java应用程序(注:到Eclipse 3.3使用之前 运行>运行方式> SWT的应用)。

在Eclipse之外运行独立的SWT示例

(注意:这些说明仅适用于Eclipse 3.3及更高版本)要独立运行ControlExample或CustomControlExample:

  1. 转到 http://download.eclipse.org/eclipse/downloads/上的Eclipse下载页面。

  2. 单击您想要示例的Eclipse构建(即您正在运行的Eclipse / SWT构建;通常是最新的Stable Build)。

  3. 向下滚动,直至看到“示例插件”,下载适用于您平台的.zip,然后将其解压缩到本地计算机。

  4. 在具有提取的示例插件的目录中,查找文件org.eclipse.swt.examples_<version>.jar,并将其解压缩到位。

  5. 打开DOS窗口(在Windows上)或终端窗口(在Mac或Linux上)并导航到此目录。

  6. 若要运行该示例,请键入以下行,并替换相应的路径:<pathToYourJRE>\bin\java -classpath <pathOfYourPlatformSWTjar>;.\swtexamples.jar org.eclipse.swt.examples.controlexample.ControlExample

    这是ControlExample。每个控件都有一个选项卡,您可以更改各种样式等,以查看控件中的更改。要运行CustomControlExample,只需在步骤6中使用类名CustomControlExample而不是ControlExample。

nstalling the examples

Installing examples within Eclipse

The Eclipse SDK examples are found on the Eclipse project update site. To locate and install them into a product:

  1. command link

    Help > Install New Software...](javascript:executeCommand("org.eclipse.equinox.p2.ui.sdk.install")). This opens the Install Wizard.

  2. Select The Eclipse Project Updates site.

  3. Ensure Group items by category is unchecked.

  4. Type "Eclipse SDK Examples" in the search field.

  5. Select "Eclipse SDK Examples" and click Next.

  6. Review the items being installed, and click Next.

  7. Review and accept the license terms, and click Finish.

  8. Click Yes when asked to exit and restart the workbench for the changes to take effect. The examples are now installed in the workbench. Note: you can also click on Apply Now to dynamically install the examples into the current configuration.

Installing examples manually

To install the examples from a stand-alone zip file:

  1. Download the appropriate Eclipse SDK Example zip file from the Eclipse project web site at http://download.eclipse.org/eclipse.
  2. Extract the contents of the zip file to a new empty directory inside the <tt>dropins</tt> directory of your Eclipse installation.
  3. Start or restart Eclipse.

You can verify that examples have been installed by looking for File > New > Example... in the workbench menu bar.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值