* @author mic_scofield
package com.mic_scofield.cn;
import java.io.File;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class AboutDialog extends TitleAreaDialog {
private String versionStr;
private final static String VERSION_CONFIG_DLL_PATH = "config/Version.xml";
/**
* Create the dialog.
* @param parentShell
*/
public AboutDialog(Shell parentShell) {
super(parentShell);
}
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
this.getShell().setText("\u5173\u4e8e...");
setTitle("\u5173\u4E8E\u5BF9\u8BDD\u6846\u63D0\u793A\u4FE1\u606F\uFF0C\u53EF\u4EE5\u662F\u516C\u53F8\u6807\u5FD7\u6216\u8005\u5168\u79F0");
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
{
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 366;
gridData.grabExcessVerticalSpace = false;
container.setLayoutData(gridData);
}
{
Label lblVersionTitle = new Label(container, SWT.NONE);
lblVersionTitle.setBounds(20, 10, 221, 19);
//TODO
lblVersionTitle.setText("\u7248\u672c:");
}
{
Label lblVersionValue = new Label(container, SWT.NONE);
lblVersionValue.setBounds(66, 35, 468, 29);
versionStr = readVersionInfo();
lblVersionValue.setText(versionStr);
}
{
Label lblWorkingDirectoryTitle = new Label(container, SWT.NONE);
lblWorkingDirectoryTitle.setBounds(20, 70, 221, 19);
//TODO
lblWorkingDirectoryTitle.setText("\u8fd0\u884c\u8def\u5f84:");
}
{
Label lblWorkingDirectoryValue = new Label(container, SWT.NONE);
lblWorkingDirectoryValue.setBounds(66, 95, 468, 45);
lblWorkingDirectoryValue.setText(System.getProperty("user.dir")); //$NON-NLS-1$
}
return area;
}
/**
* Create contents of the button bar.
* @param parent
*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
true);
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
}
/**
* Return the initial size of the dialog.
*/
@Override
protected Point getInitialSize() {
return new Point(450, 300);
}
private String readVersionInfo()
{
SAXReader saxReader = new SAXReader();
Document doc = null;
StringBuffer valueStr;
File file = new File(VERSION_CONFIG_DLL_PATH);
try
{
doc = saxReader.read(file);
Element eleCmd = (Element)doc.selectSingleNode("version"); //$NON-NLS-1$
valueStr = new StringBuffer(eleCmd.attributeValue("value")); //$NON-NLS-1$
String dateStr = eleCmd.attributeValue("date"); //$NON-NLS-1$
valueStr.append(" "); //$NON-NLS-1$
valueStr.append(dateStr);
}
catch (DocumentException e1)
{
//TODO log
return null;
}
return valueStr.toString();
}
}
Version.xml
<?xml version="1.0" encoding="UTF-8"?>
<version value="V01B001C0001" date="2010-5-31"/>
分享到:
相关推荐
org.eclipse.swt.SWT.class org.eclipse.swt.SWTError.class org.eclipse.swt.SWTException.class org.eclipse.swt.accessibility.ACC.class org.eclipse.swt.accessibility.Accessible.class org.eclipse.swt....
下载编译的SWT库,版本号4.911,包含多个版本: org.eclipse.swt.cocoa.macosx.x86_64 org.eclipse.swt.gtk.linux.aarch64 org.eclipse.swt.gtk.linux.arm org.eclipse.swt.gtk.linux.ppc64le org.eclipse.swt.gtk....
64位windows操作系统使用的SWT库
《Eclipse SWT/Jface核心应用》全面介绍了SWT、JFace和RCP的相关知识。全书共分5篇,第1篇介绍了SWT产生的背景以及SWT的一些基本概念和基础知识。第2篇介绍了SWT基本控件的使用,以及事件处理、布局等SWT基本知识的...
SWT examples,SWT官方例子:http://www.eclipse.org/swt/examples.php 该页面所要下载的例子 其中,swt的例子在\plugins\org.eclipse.swt.examples.source_3.7.0.v3740f.jar中
swt框架 适用与window下java窗口开发~~~~
swt 画图小程序 自由画线 矩形。。import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseMoveListener; ...
SWT-Internal-Video使用SWT技术对视频的常用显示功能进行了实现和封装,并提供了API。 它的接口之灵活性可以满足视频显示上的很多要求 与 情况。 SWT-Internal-Video解决的是程序与视频设备DVR/DVS之间的链接,并...
SWT配置 SWT配置 SWT配置 SWT配置 SWT配置 SWT配置 SWT配置 SWT配置
SWT官方api文档 开发基于swt的GUI程序必备手册
基本上关于swt_win32_extension该有的都有了,其中org.eclipse.swt.win32.jar并不是必须的,如果出现OS.class未找到异常等,就在构建路径里加上org.sf.feeling.swt.win32.extension_1.1.0.jar这个包就可以了。...
这是我找到的最全的SWT示例,即使在官方网站上也非常难找,示例包括以下内容:SWT模式窗体,SWT浏览器,SWT树,SWT工具条,SWT画图工具,SWT图形,SWT各种布局,SWT剪贴板,SWT快捷键,SWT菜单,SWT文本编辑器,SWT...
swt资源释放问题,详细介绍swt如何释放屏幕资源
SWT本身仅仅是Eclipse组织为了开发 Eclipse IDE环境所编写的一组底层图形界面 API。或许是无心插柳,或是有意为之,至今为止,SWT无论是在性能和外观上,都超越了SUN公司提供的AWT和SWING。目前Eclipse IDE已经开发...
swt table 实现换行
SWT Table 单元格编辑实例代码
JFace是建立在SWT之上的UI部件,是Eclipse组织为了开发Eclipse IDE环境所编写的一组底层图形界面 API,其底层实现为SWT。它扩展了 SWT并能与 SWT 交互操作。JFace工具箱提供了一组功能强大的用户界面组件,开发人员...
开发swt用的swt.jar包下载。资源分1分,记得评论哦~
java SWT 基本窗口 组件 开发
swt工具文档 swt工具文档 swt工具文档 swt工具文档 swt工具文档 swt工具文档