内蒙古师范大学青年政治学院信息工程系毕业设计说明书(毕业论文)
}
publicstaticint executeUpdate(String sql) { }
inti = 0 ; try {
i = ste.executeUpdate(sql) ;
conn.commit();
}catch(Exception e) { }
returni ;
e.printStackTrace() ;
5.2基本信息管理模块
5.2.1房建项目设置
在工程中增加系统设置类Setup,为此继承Java系统的JDialog类;同时实现监听器,只要在窗体上发生动作或者单击鼠标,都会触发相应事件;再定义 “系统设置”窗体需要的各种组件。其代码如下:
publicclassSetupextends JDialog implements ActionListener, MouseListener,WindowListener{ public Setup(JFrame frame) {
super (frame, \系统设置\, true); top = new JLabel();
//假空格
panelMain = new JPanel(new BorderLayout(0,10)); tab();
//制作系统设置项目标签面板
//加入事件监听
addListener();
panelMain.add(\,top); panelMain.add(\,tp); this.setContentPane(panelMain);
this.setPreferredSize (new Dimension (718,508)); this.setMinimumSize (new Dimension (718,508));
20
第五章 系统的实现
}
this.setResizable(false); pack();
//不允许改变窗口大小
sunswing.setWindowCenter(this); //窗口屏幕居中 this.addWindowListener(this);
privatevoid addListener() {
bt11.addActionListener(this); bt12.addActionListener(this); bt13.addActionListener(this); bt14.addActionListener(this); bt15.addActionListener(this); bt16.addActionListener(this);
//加动作监听
5.2.2客户类型设置
在工程中增加客户类的添加类AddCustomerType,此类继承Java系统的JDialog类,同时实现监听器,只要窗体上发生动作或者单击鼠标,都会触发相应事件;再定义该窗体需要的各种组件。其代码如下:
publicclassAddCustomerTypeextends JDialog implements ActionListener {
public AddCustomerType(JDialog dialog) {
super(dialog, \客户类型\, true); JLabel lb, lb1, lb2, lb4;
JPanel panelMain, panelInfo, p1, p2, p3, p4, p5;//定义组件面板 p1 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 0)); p2 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 0)); p3 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 0)); p5 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 0)); p4 = new JPanel(new FlowLayout(FlowLayout.CENTER, 30, 6)); panelInfo = new JPanel(new GridLayout(4, 1, 0, 0)); panelMain = new JPanel(new BorderLayout()); lb1 = new JLabel(\客户类型:\); lb2 = new JLabel(\打折比例:\);
21
内蒙古师范大学青年政治学院信息工程系毕业设计说明书(毕业论文)
lb4 = new JLabel(\类型编号:\);
lb = new JLabel(\注:此打折比例仅适用于商品项目!
8
为八折,10为不打折\);
lb.setForeground(new Color(255, 138, 0)); tf1 = new TJTextField(7); tf2 = new TJTextField(7); tf3 = new TJTextField(\, 7);
bt1 = new TJButton (\, \确定\, \确定添加客户类型\); bt2 = new TJButton (\, \取消\, \取消操作\);
privatevoid addListener() { } }
bt1.addActionListener(this); bt2.addActionListener(this); tf1.addActionListener(this); tf2.addActionListener(this); tf3.addActionListener(this);
(1)下面定义actionPerformed方法,其代码如下: publicvoid actionPerformed(ActionEvent ae) {
Object o = ae.getSource(); if(o == bt1) {
//确定 //保存数据
saveAddCustomerType();
}elseif(o == bt2) {
//取消
this.setVisible(false);
//客户类型
}elseif(o == tf1) {
tf2.requestFocus(true);
//客户类型
}elseif(o == tf2) {
tf3.requestFocus(true);
//折扣
//保存数据
}elseif(o == tf3) {
saveAddCustomerType();
22
第五章 系统的实现
}
}//Endif
5.2.3计费设置
在setup类中增加jiFei方法,其代码如下: private JPanel jiFei() {
JLabel lb1, lb2, lb3, lb4, lb5, lb6, lb7, lb8, lb9, lb10,
lb11, lb12, lb13, lb14, lb15, lb16;
//定义各方位面板
JPanel panelJF, jfTop, jfLeft, jfRight, jfBott; JPanel jp1, jp2, jp3, jp4, jp5, jp6, jp7, jp8, jp9;
//定义标签
lb1 = new JLabel(\ 客人开房时间在\); lb2 = new JLabel(\点之后按新的一天开始计费\); lb3 = new JLabel(\ 客人退房时间在\); lb4 = new JLabel(\点之后计价天数自动追加半天\); lb5 = new JLabel(\ 客人退房时间在\); lb6 = new JLabel(\点之后计价天数自动追加一天\); lb7 = new JLabel(\ 开房后\); lb8 = new JLabel(\分钟开始计费\); lb9 = new JLabel(\ 最少按\);
lb10 = new JLabel(\小时计费,小于这个时间的按此时间计费\); lb11 = new JLabel(\ 若不足一小时但超过\); lb12 = new JLabel(\分钟的部分按1小时计费\); lb13 = new JLabel(\ 不足上面分钟数但超过\); lb14 = new JLabel(\分钟的部分按半小时计费\);
lb15 = new JLabel(\注:此设置仅限于标准计费的钟点房! \); lb16 = new JLabel(\ \);
lb15.setForeground(new Color(255, 138, 0)); //初始化计时计费设置
tf41 = new TJTextField(sunini.getIniKey(\), 5);
23
内蒙古师范大学青年政治学院信息工程系毕业设计说明书(毕业论文)
tf42 = new TJTextField(sunini.getIniKey(\), 5); tf43 = new TJTextField(sunini.getIniKey(\), 5); tf44 = new TJTextField(sunini.getIniKey(\), 5); tf45 = new TJTextField(sunini.getIniKey(\), 5); tf46 = new TJTextField(sunini.getIniKey(\), 5);
tf47 = new TJTextField(sunini.getIniKey(\), 5);
5.3.2营业查询
在工程中添加营业查询类Query,并且定义好“营业查询”窗体需要的各种组件。本模块的查询操作包括结账单查询、全部宾客信息查询、在店宾客消费查询、离店宾客消费查询等。本项目集查询功能于同一窗体。在代码中增加各种查询所需的监听器,只要窗体上发生动作或者单击鼠标,都会触发相应事件。其代码如下:
publicclassQueryextends JDialog implements ActionListener, MouseListener {
public Query(JFrame frame) { }
super(frame,\营业查询\,true); top = new JLabel();
//假空格
panelMain = new JPanel(new BorderLayout(0,5)); tab();
//制作系统设置项目标签面板
//加入事件监听
addListener();
panelMain.add(\,top); panelMain.add(\,tp); this.setContentPane(panelMain);
this.setPreferredSize (new Dimension (800,500)); this.setMinimumSize (new Dimension (800,500)); this.setResizable(false); pack();
sunswing.setWindowCenter(this); //窗口屏幕居中
//不允许改变窗口大小
24
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库基于JAVA的酒店管理系统的设计与实现(毕业论文)(6)在线全文阅读。
相关推荐: