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台式电脑上安装过去
接着就搞定了。
不能小瞧这些人啊,要做好质量工作。