package swtstudy.ui;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import swtstudy.bean.Purview;
import swtstudy.biz.LogoBiz;
import swtstudy.biz.WindowsAppBiz;
import swtstudy.tools.ValidateNum;
import com.swtdesigner.ResourceManager;
/**
* @author longlong 用户主界面
*/
public class WindowsApp extends Shell implements MouseTrackListener {
int userid = 0;
int state = 0;
public WindowsApp(int userid, int state, Display display, int style) {
super(display, style);
this.userid = userid;
this.state = state;
createContents();
}
public WindowsApp self() {
return this;
}
protected void createContents() {
setText("企业项目管理系统");
setSize(600, 690);
setLayout(new FormLayout());
//设置图标
ImageDescriptor image = ImageDescriptor.createFromFile(
WindowsApp.class, "image\\index.jpg");
this.setImage(image.createImage());
final String statestr = state == 1 ? "管理员" : "普通用户";
//状态栏
final Label zhuangtailan = new Label(this, SWT.BORDER);
zhuangtailan.setBackground(ResourceManager.getColor(220, 220, 220));
final FormData formData_2 = new FormData();
formData_2.bottom = new FormAttachment(100, -5);
formData_2.right = new FormAttachment(100, -5);
formData_2.left = new FormAttachment(0, 5);
zhuangtailan.setLayoutData(formData_2);
zhuangtailan
.setText("用户ID:" + userid + " 欢迎你~!您以:" + statestr + "身份登录");
//用户工作区
final Composite composite = new Composite(this, SWT.NONE);
final StackLayout stackLayout = new StackLayout();
composite.setLayout(stackLayout);
final FormData formData_1 = new FormData();
formData_1.left = new FormAttachment(zhuangtailan, 0, SWT.LEFT);
formData_1.top = new FormAttachment(0, 70);
formData_1.right = new FormAttachment(zhuangtailan, 0, SWT.RIGHT);
formData_1.bottom = new FormAttachment(zhuangtailan, -5, SWT.TOP);
composite.setLayoutData(formData_1);
composite.addMouseTrackListener(new MouseTrackListener() {
public void mouseEnter(MouseEvent e) {
zhuangtailan.setText("用户工作区");
}
public void mouseExit(MouseEvent e) {
zhuangtailan.setText("用户ID:" + userid + " 欢迎你~!您以:" + statestr
+ "身份登录");
}
public void mouseHover(MouseEvent e) {
}
});
//实例化背景标签面板
final BackdropUi backdropUi = new BackdropUi(composite, SWT.NO);
stackLayout.topControl = backdropUi;
composite.layout();//初始化将其置顶
backdropUi.addMouseTrackListener(new MouseTrackListener() {
public void mouseEnter(MouseEvent e) {
zhuangtailan.setText("软件背景图片");
}
public void mouseExit(MouseEvent e) {
zhuangtailan.setText("用户ID:" + userid + " 欢迎你~!您以:" + statestr
+ "身份登录");
}
public void mouseHover(MouseEvent e) {
}
});
//登录用户管理面板
final AdminManage userInfo = new AdminManage(userid, state, composite,
SWT.NO);
backdropUi.addMouseTrackListener(new MouseTrackListener() {
public void mouseEnter(MouseEvent e) {
zhuangtailan.setText("登录用户管理界面");
}
public void mouseExit(MouseEvent e) {
zhuangtailan.setText("用户ID:" + userid + " 欢迎你~!您以:" + statestr
+ "身份登录");
}
public void mouseHover(MouseEvent e) {
}
});
//浏览工程面板
final BrowsePro browsePro = new BrowsePro(composite, SWT.NO);
//浏览职工面板
final BrowseEmpl browseEmpl = new BrowseEmpl(composite, SWT.NO);
//浏览职务面板
final BrowseDuty browseDuty = new BrowseDuty(composite, SWT.NO);
//菜单开始
final Menu menu = new Menu(this, SWT.BAR);
setMenuBar(menu);
//文件菜单
final MenuItem menuItem_file = new MenuItem(menu, SWT.CASCADE);
menuItem_file.setSelection(true);
menuItem_file.setText("文件(&F)");
final Menu menu_1 = new Menu(menuItem_file);
menuItem_file.setMenu(menu_1);
final MenuItem menuItem_openfile = new MenuItem(menu_1, SWT.NONE);
menuItem_openfile.setText("打开文件\tCtrl+N");
menuItem_openfile.setAccelerator(SWT.CTRL + 'N');
final MenuItem menuItem_6 = new MenuItem(menu_1, SWT.NONE);
menuItem_6.setText("关闭文件\tCtrl+C");
menuItem_6.setAccelerator(SWT.CTRL + 'C');
new MenuItem(menu_1, SWT.SEPARATOR);
final MenuItem menuItem_4 = new MenuItem(menu_1, SWT.NONE);
menuItem_4.setText("退出管理(&M)\tCtrl+Shift+M");
menuItem_4.setAccelerator(SWT.CTRL +SWT.SHIFT+ 'M');
final MenuItem menuItem_5 = new MenuItem(menu_1, SWT.NONE);
menuItem_5.setText("重新登录(&R)\tCtrl+Shift+R");
menuItem_5.setAccelerator(SWT.CTRL +SWT.SHIFT+ 'R');
new MenuItem(menu_1, SWT.SEPARATOR);
final MenuItem menuItem_7 = new MenuItem(menu_1, SWT.NONE);
menuItem_7.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
WindowsAppBiz windowsAppBiz = new WindowsAppBiz();
boolean fla = windowsAppBiz.line();
if (fla) {
MessageDialog.openInformation(self(), "恭喜","数据库连接正常~!\n\n您可以进行数据库的操作");
} else {
if (MessageDialog.openConfirm(self(), "错误","数据库无法连接~!\n\n点击是更改数据库连接,点击否关闭对话框")) {
ConfigUI configUI = new ConfigUI(null, SWT.NO);
configUI.open();
}
}
}
});
menuItem_7.setText("测试连接\tF11");
menuItem_7.setAccelerator(SWT.F11);
final MenuItem menuItem_8 = new MenuItem(menu_1, SWT.NONE);
menuItem_8.setText("更改数据库连接\tF12");
menuItem_8.setAccelerator(SWT.F12);
menuItem_8.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ConfigUI configUI = new ConfigUI(null, SWT.NO);
configUI.open();
}
});
new MenuItem(menu_1, SWT.SEPARATOR);
final MenuItem menuItem_32 = new MenuItem(menu_1, SWT.NONE);
menuItem_32.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl = backdropUi;
composite.layout();
}
});
menuItem_32.setText("打开背景图片\tCtrl+Shift+B");
menuItem_32.setAccelerator(SWT.CTRL + SWT.SHIFT + 'B');
new MenuItem(menu_1, SWT.SEPARATOR);
final MenuItem menuItem_9 = new MenuItem(menu_1, SWT.NONE);
menuItem_9.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.exit(1);
}
});
menuItem_9.setText("退出程序(&E)");
//工程管理菜单
final MenuItem menuItem_pro = new MenuItem(menu, SWT.CASCADE);
menuItem_pro.setText("工程管理(&P)");
final Menu menu_2 = new Menu(menuItem_pro);
menuItem_pro.setMenu(menu_2);
final MenuItem menuItem_10 = new MenuItem(menu_2, SWT.NONE);
menuItem_10.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//添加工程面板
final AddPro addPro = new AddPro(composite, SWT.NO);
stackLayout.topControl = addPro;
composite.layout();
}
});
menuItem_10.setText("添加工程(&A)");
final MenuItem menuItem_11 = new MenuItem(menu_2, SWT.NONE);
menuItem_11.addSelectionListener(
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于swt的企业项目管理系统 (189个子文件)
jdbc.properties.bak 200B
概念模型.cdm 40KB
WindowsApp.class 14KB
ResourceManager.class 12KB
BrowseEmpl.class 10KB
BrowseDuty.class 10KB
BrowsePro.class 10KB
ConfigUI.class 9KB
Logo.class 8KB
DelPro.class 5KB
AgainLogo.class 5KB
EditPro.class 5KB
WindowsApp$23.class 4KB
ScanData.class 4KB
UserInfo.class 4KB
Addduty.class 4KB
AddPro.class 3KB
AdminManage.class 3KB
ManageUser.class 3KB
FindPro.class 2KB
BrowseEmpl$4.class 2KB
BrowseDuty$4.class 2KB
BrowseEmpl$1.class 2KB
WindowsApp$22.class 2KB
BrowsePro$4.class 2KB
BrowseDuty$1.class 2KB
BrowsePro$1.class 2KB
ConfigUI$2.class 2KB
RondomImage.class 2KB
ConfigBiz.class 2KB
ConfigObject.class 2KB
FilePut.class 2KB
AdminManage$1.class 2KB
FindRow.class 2KB
BrowseEmpl$2.class 2KB
BrowseDuty$2.class 2KB
BrowsePro$2.class 2KB
BrowseEmpl$3.class 2KB
BrowseDuty$3.class 2KB
BrowsePro$3.class 2KB
BackdropUi.class 2KB
Purview.class 2KB
WindowsApp$4.class 1KB
WindowsApp$3.class 1KB
WindowsApp$15.class 1KB
WindowsApp$2.class 1KB
WindowsApp$1.class 1KB
DelPro$2.class 1KB
BrowseEmpl$TableLabelProvider.class 1KB
DelPro$3.class 1KB
EditPro$2.class 1KB
LogoBiz.class 1KB
BrowseDuty$TableLabelProvider.class 1KB
WindowsApp$20.class 1KB
Dblogo.class 1KB
BrowseBiz.class 1KB
ConfigUI$1.class 1KB
WindowsApp$13.class 1KB
WindowsApp$9.class 1KB
WindowsApp$10.class 1KB
WindowsApp$8.class 1KB
BrowsePro$TableLabelProvider.class 1KB
WindowsApp$12.class 1KB
WindowsApp$14.class 1KB
WindowsApp$18.class 1KB
WindowsApp$19.class 1KB
WindowsApp$17.class 1KB
WindowsApp$6.class 1KB
WindowsApp$11.class 1KB
WindowsApp$16.class 1KB
BrowseDuty$ContentProvider.class 1KB
BrowseEmpl$ContentProvider.class 1KB
BrowsePro$ContentProvider.class 1KB
Logo$3.class 1KB
UserInfo$1.class 1KB
Employee.class 1KB
Hour.class 967B
Logo$2.class 945B
Incept.class 912B
Logo$4.class 875B
ConfigUI$3.class 834B
Project.class 802B
Duty.class 799B
WindowsApp$5.class 786B
Addduty$1.class 783B
DelPro$1.class 777B
ValidateNum.class 759B
ResourceManager$1.class 719B
Logo$1.class 712B
WindowsApp$21.class 679B
WindowsApp$7.class 677B
EditPro$1.class 664B
WindowsAppBiz.class 597B
.classpath 2KB
swt-win32-3063.dll 300KB
swt-win32-3062.dll 300KB
swt-awt-win32-3062.dll 32KB
swt-awt-win32-3063.dll 32KB
gif323.gif 15KB
gif323.gif 15KB
共 189 条
- 1
- 2
资源评论
- 流风清音2012-11-19部分功能没实现。。不过总体还是不错的。。
- moonlight1022013-01-23只有执行文件没有源码!怎么不上传源码啊!我想看具体实现过程!
- 拉格纳2012-11-30有价值的参考, 界面不漂亮,这是一大失望。。。难道是SWT天生缺陷.
书智
- 粉丝: 5
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功