SWT/Jface

package ce.system;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

import com.itextpdf.text.pdf.PdfReader;

/**
 * 国土系统统计分析主程序
 * 
//01:档案信息化,扫描统计
//02:档案信息化,质量要求(1:正确计算率  2:错误处理)
//03:档案信息化,成本
//04:成员名单(27人大名单):
//BAOYUWEI HOURUINAN CHENSHENGHUA LIAOZHUHUI HUWEIHUI CHENXINHAO 
//ZHANGXIAOTAO CANWENFAN TANJUNHAO WENHONGHAO CAIRUOHAN TONGSHUN
//CHENCHONGYUAN LINXUANZHI CHENMIN HUANGTAO QIUZHENGBAO YEZIWEI
//HEJIANHUA CIWENBIN ZHANGZHONGXIANG LINZHENNI ZHANGMINGHAO
//XUXIAOQING WEIHONGYAN
 * 
 * 
 * @author ZengWenFeng
 */
public class MainApp
{
	private Text txtInput;
	private Text txtOutput;
	private Label label;
	
	protected Shell shell;

	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String[] args)
	{
		try
		{
			MainApp window = new MainApp();
			window.open();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	/**
	 * Open the window
	 */
	public void open()
	{
		final Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed())
		{
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	/**
	 * Create contents of the window
	 */
	protected void createContents()
	{
		shell = new Shell();
		shell.setSize(556, 307);
		shell.setText("SWT Application -- winkey tseng");

		//
		final Button selectButton = new Button(shell, SWT.NONE);
		selectButton.addMouseListener(new MouseAdapter() 
		{
			public void mouseUp(final MouseEvent e)
			{
				
			}
			public void mouseDown(final MouseEvent e)
			{
				
			}
		});
		selectButton.addSelectionListener(new SelectionAdapter() 
		{
			public void widgetSelected(final SelectionEvent e)
			{
				//
				txtInput.setText("");
				txtOutput.setText("");
				
				//
				String fileName = folderDlg(shell); 
				txtInput.setText(fileName);
				
				PdfReader reader = null;
				
				try
				{
					PdfPageCounter.readFolder(reader, fileName, txtOutput);
				}
				catch (IOException e1)
				{
					e1.printStackTrace();
				}
				
				
				//
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
				String time = sdf.format(new Date());
				
				//
				System.out.println(fileName + " [" + PdfPageCounter.page + ", " + PdfPageCounter.cnt + "] " + time);
				txtOutput.setText(fileName + " [" + PdfPageCounter.page + ", " + PdfPageCounter.cnt + "] " + time);
			}
		});
		selectButton.setText("select");
		selectButton.setBounds(10, 40, 68, 22);

		txtInput = new Text(shell, SWT.BORDER);
		txtInput.setEditable(false);
		txtInput.setBounds(10, 82, 528, 25);

		txtOutput = new Text(shell, SWT.BORDER);
		txtOutput.setBounds(10, 162, 528, 25);

		label = new Label(shell, SWT.NONE);
		label.setText("desc:计算器   author:曾文锋  date:2011-08-21");
		label.setBounds(59, 238, 317, 12);
		//
	}
	
	
	protected void fileDlg(Shell parent)
	{
		FileDialog filedlg = new FileDialog(parent,SWT.OPEN);
		
		filedlg.setText("�ļ�ѡ��");
		
		filedlg.setFilterPath("SystemRoot");
		
		String selected = filedlg.open();
		
		System.out.println("��ѡ�е��ļ�·��Ϊ��" + selected);                
	}

	protected String folderDlg(Shell parent)
	{
		DirectoryDialog folderdlg = new DirectoryDialog(parent);
		
		folderdlg.setText("�ļ�ѡ��");
		
		folderdlg.setFilterPath("SystemDrive");
		
		folderdlg.setMessage("��ѡ����Ӧ���ļ���");
		
		String selecteddir = folderdlg.open();
		
		//
		return selecteddir;
	}
}


PrjSwt就是一个桌面小程序,就是统计等等比较多。
完成后,用exe4j打包成PrjSwt。
记得把运行环境打包进去。

然后呢,就是放到普通的PC台式电脑上安装过去

接着就搞定了。

不能小瞧这些人啊,要做好质量工作。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值