⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.java

📁 用JAVA完成的酒店管理系统.包括需求说明.数据库.设计文档在内.适合于新手.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/**
 *##############################################################################
 *
 *	[ 项目名      ]  : 阳光酒店管理系统
 *  [ 公司名      ]  : 清华IT
 *	[ 模块名      ]  : 系统设置模块
 *	[ 文件名      ]  : Setup.java
 *	[ 相关文件    ]  : 
 *	[ 文件实现功能]  : 组织系统设置窗口
 *	[ 作者        ]  : 董丰
 *	[ 版本        ]  : 1.1
 *	----------------------------------------------------------------------------
 *	[ 备注        ]  : 
 *	----------------------------------------------------------------------------
 *	[ 修改记录    ]  : 
 *
 *	[ 日  期 ]     [版本]         [修改人]         [修改内容] 
 *	2006/04/19      1.0             董丰            创建
 *	2006/04/22      1.1             顾俊            实现数据保存
 *	##--------------------------------------------------------------------------
 *  			 版权所有(c) 2006-2007,  SunshineSOFT Corporation
 *	--------------------------------------------------------------------------##
 *	
 *	[ 函数说明    ]  :			看类内各函数开头
 *	
 *  [ 遗留问题    ]  : 
 *
 *##############################################################################
 */
package com.sunshine.setup;

import javax.swing.*;
import javax.swing.border.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import com.sunshine.sunsdk.sql.*;			//公共类库
import com.sunshine.sunsdk.system.*;
import com.sunshine.sunsdk.swing.*;
import com.sunshine.mainframe.HotelFrame;	//加载主窗口


public class Setup 
extends JDialog 
implements ActionListener, MouseListener {
	
	private JLabel top,bott;
	private JTabbedPane tp;
	private JPanel panelMain;
	//=========房间项目设置
	private JTable tb11, tb12;
	private DefaultTableModel dtm11, dtm12;		//房间类型列表//房间信息列表
	 
	private JScrollPane sp11,sp12;
	private JComboBox cb11,cb12;
			    //房间类型,可供/清理状态
	private JButton bt11, bt12, bt13, bt14, bt15, bt16, bt17, bt18, bt19, bt20;
			      //添加, 修改,删除LX,折扣,单个,批量添加,删除,修改FJ,保存,筛选
	private JTextField tf11;
	//=========客户类型设置
	private JTable tb21,tb22;
	private DefaultTableModel dtm21,dtm22;
			         //客户类型列表,房间费打折列表
	private JScrollPane sp21,sp22;
	private JButton bt21, bt22, bt23, bt24;
			      //添加, 修改,删除LX,房费打折
	//=========操作员设置
	private JTable tb31;
	private DefaultTableModel dtm31;
						//操作员列表
	private JScrollPane sp31;
	private JComboBox cb31;//用户名
	private JPasswordField tf31, tf32, tf33;
			 	   		//原密码,新密码,确认密码
	private JRadioButton rb31,   rb32,   rb33,   rb34,   rb35;
				//新用户登记, 修改密码,删除用户,普通用户,管理员
	private JButton bt31, bt32, bt33;
	 		     // 登记, 修改, 删除
	//=========计费设置
	private JTextField tf41, tf42, tf43, tf44, tf45, tf46, tf47; 
	private JCheckBox ck;
	private JButton bt41, bt42;
	
	//提示信息
	String msg0 = "您确定要删除在表格中选中的资料条目吗?";
	String msg1 = "请在相应的表格中选定条目,再点删除键 ...";
	//日志信息
	String journal;
	//INI文件中的键名
	String ini[] = { "[SOFTINFO]", "UserName", "CompName", "[CONFIG]", "Soft_First",
					 "Default_Link" , "Default_Page", "Sys_style", "[NUMBER]",
					 "LodgName", "LodgNumber", "EngaName", "EngaNumber", "ChouName", 
					 "ChouNumber", "[HABITUS]", "Ck_Habitus", "Ck_Minute", "[PARTTIME]", 
					 "In_Room", "Out_Room1", "Out_Room2", "InsuDay", "ClockRoom1", 
					 "ClockRoom2", "InsuHour1", "InsuHour2", "[JDBC]", "DBFname", 
					 "UserID", "Password", "IP", "Access", "[ODBC]", "LinkName" };
	
	//实例化功能模块
	//========================================================================//
		AddRoomType			art	 = new AddRoomType (this);		//添加房间类型
		ModiRoomType		mrt  = new ModiRoomType(this);		//添加房间类型
		AddCustomerType		act  = new AddCustomerType(this); 	//添加客户类型
		ModiCustomerType	mct  = new ModiCustomerType(this);	//添加客户类型
		Discount			dis  = new Discount(this);			//折扣设置
		AddRoomInfo 		ari  = new AddRoomInfo(this);		//单个添加房间
		AddRoomInfos		aris = new AddRoomInfos(this);		//批量添加房间
		ModiRoomInfo		mri  = new ModiRoomInfo(this);		//修改房间信息
	//========================================================================//
	
	/**=======================================================================**
	 *		[## public Setup(JFrame frame) {} ]: 		构造函数
	 *			参数   :JDialog对象表示本对话框的父窗口
	 *			返回值 :无
	 *			修饰符 :public
	 *			功能   :组建系统设置模块
	 **=======================================================================**
	 */
	public Setup(JFrame frame) {
		super (frame, "系统设置", true);
		top = new JLabel();		//假空格
		panelMain = new JPanel(new BorderLayout(0,10));
		tab();					//制作系统设置项目标签面板
		addListener();			//加入事件监听
		panelMain.add("North",top);
		panelMain.add("Center",tp);
		this.setContentPane(panelMain);
		this.setPreferredSize (new Dimension (718,508));
		this.setMinimumSize (new Dimension (718,508));
		this.setResizable(false);		//不允许改变窗口大小
		pack();
		sunswing.setWindowCenter(this);	//窗口屏幕居中
	}
	
	/**=======================================================================**
	 *		[## private void addListener() {} ]: 		加事件监听
	 *			参数   :无
	 *			返回值 :无
	 *			修饰符 :private
	 *			功能   :加事件监听
	 **=======================================================================**
	 */
	private void addListener() {
		bt11.addActionListener(this);		//加动作监听
		bt12.addActionListener(this);
		bt13.addActionListener(this);
		bt14.addActionListener(this);
		bt15.addActionListener(this);
		bt16.addActionListener(this);
		bt17.addActionListener(this);
		bt18.addActionListener(this);
		bt19.addActionListener(this);
		bt20.addActionListener(this);
		bt21.addActionListener(this);
		bt22.addActionListener(this);
		bt23.addActionListener(this);
		bt24.addActionListener(this);
		bt31.addActionListener(this);
		bt32.addActionListener(this);
		bt33.addActionListener(this);
		bt41.addActionListener(this);
		bt42.addActionListener(this);
		rb31.addActionListener(this);		//操作员作操范围监听
		rb32.addActionListener(this);
		rb33.addActionListener(this);
		tf41.addActionListener(this);		//计费设置文本框加监听
		tf42.addActionListener(this);
		tf43.addActionListener(this);
		tf44.addActionListener(this);
		tf45.addActionListener(this);
		tf46.addActionListener(this);
		bt11.addMouseListener(this);		//加鼠标监听
		bt12.addMouseListener(this);
		bt13.addMouseListener(this);
		bt14.addMouseListener(this);
		bt15.addMouseListener(this);
		bt16.addMouseListener(this);
		bt17.addMouseListener(this);
		bt18.addMouseListener(this);
		bt19.addMouseListener(this);
		bt20.addMouseListener(this);
		bt21.addMouseListener(this);
		bt22.addMouseListener(this);
		bt23.addMouseListener(this);
		bt24.addMouseListener(this);
		bt31.addMouseListener(this);
		bt32.addMouseListener(this);
		bt33.addMouseListener(this);
		bt41.addMouseListener(this);
		bt42.addMouseListener(this);
	}
	
	/**=======================================================================**
	 *		[## private void tab() {} ]: 		制作系统设置项目标签面板
	 *			参数   :无
	 *			返回值 :无
	 *			修饰符 :private
	 *			功能   :制作系统设置项目标签面板
	 **=======================================================================**
	 */
	private void tab() {
		JPanel jp1,jp2,jp3,jp4;
		///////////////////////////////////////////////-------模块面板接口
		jp1 = fangjian();		//房间项目设置
		jp2 = kehu();			//客户类型设置
		jp3 = caozuo();			//操作员设置
		jp4 = jiFei();			//计费设置
		//////////////////////////////////////////////////////////////////
		tp = new JTabbedPane();
		tp.addTab("房间项目设置", new ImageIcon("pic/u01.gif"), jp1);
		tp.addTab("客户类型设置", new ImageIcon("pic/u02.gif"), jp2);
		tp.addTab("操作员设置", new ImageIcon("pic/u03.gif"), jp3);
		tp.addTab("计费设置", new ImageIcon("pic/u04.gif"), jp4);
	}
	
	/**=======================================================================**
	 *		[## private JPanel fangjian() {} ]: 
	 *			参数   :无
	 *			返回值 :JPanel
	 *			修饰符 :private
	 *			功能   :房间项目设置
	 **=======================================================================**
	 */
	private JPanel fangjian() {
		
		dtm11 = new DefaultTableModel();
		tb11  = new JTable(dtm11);
		sp11  = new JScrollPane(tb11);
		dtm12 = new DefaultTableModel();
		tb12  = new JTable(dtm12);
		sp12  = new JScrollPane(tb12);
		
		JPanel pfangjian,pTop,pBott,pTn,pTc,pBn,pBc,pTcc,pTcs,pBcc,pBcs;
		pfangjian = new JPanel(new GridLayout(2,1,0,5));
		pTop	  = new JPanel(new BorderLayout());
		pBott	  = new JPanel(new BorderLayout());
		pTn		  = new JPanel();					//放置保存按钮等...
		pTc		  = new JPanel(new BorderLayout());	//放置房间类型列表及四个按钮
		pBn		  = new JPanel(new FlowLayout(FlowLayout.LEFT,10,0));//放置下拉列表
		pBc		  = new JPanel(new BorderLayout());	//放置房间信息列表及四个按钮
		pTcc	  = new JPanel(new GridLayout(1,1));//放置房间类型列表
		pTcs	  = new JPanel(new FlowLayout(FlowLayout.CENTER,20,5));//放置四个按钮
		pBcc	  = new JPanel(new GridLayout(1,1));//放置房间信息列表
		pBcs	  = new JPanel(new FlowLayout(FlowLayout.CENTER,20,5));//放置四个按钮
		
		//保存按钮等 ...
		JLabel lb1,lb2,lb3;
		lb1 = new JLabel("结帐后房间状态变为:    ");
		lb2 = new JLabel("          结帐后");
		lb3 = new JLabel("分钟后变为可供状态        ");
		tf11 = new TJTextField(sunini.getIniKey(ini[17]),5);		//根据INI文件给初值
		tf11.setHorizontalAlignment(JTextField.RIGHT);
		cb12 = new JComboBox();
		cb12.addItem("  可供状态     ");
		cb12.addItem("  清理状态     ");							//根据INI文件给初值
		cb12.setSelectedIndex(Integer.parseInt(sunini.getIniKey(ini[16])));
		bt19 = new TJButton ("pic/save.gif", "   保  存   ", "保存设置");
		pTn.add(lb1);
		pTn.add(cb12);
		pTn.add(lb2);
		pTn.add(tf11);
		pTn.add(lb3);
		pTn.add(bt19);
		pTn.setBorder(BorderFactory.createTitledBorder(""));
		
		//房间类型列表及四个按钮
		bt11 = new TJButton ("pic/new.gif", "添加类型", "添加房间类型");
		bt12 = new TJButton ("pic/modi0.gif", "修改类型", "修改房间类型");
		bt13 = new TJButton ("pic/del.gif", "删除类型", "删除房间类型");
		bt14 = new TJButton ("pic/modi3.gif", "房费打折", "设置房间费折扣");
		pTcc.add(sp11);
		pTcs.add(bt11);
		pTcs.add(bt12);
		pTcs.add(bt13);
		pTcs.add(bt14);
		pTc.add(pTcc);
		pTc.add("South",pTcs);
		pTc.setBorder(BorderFactory.createTitledBorder("房间类型"));
		
		//完成上半部分
		pTop.add("North",pTn);
		pTop.add(pTc);
		
		
		//下拉列表
		JLabel lb0 = new JLabel("按包厢类型过滤:  ");
		cb11 = new JComboBox();
		bt20 = new TJButton ("pic/choose1.gif", "筛  选", "筛选房间信息");
		bt20.setBorderPainted(false);
		bt20.setFocusPainted(false);
		pBn.add(lb0);
		pBn.add(cb11);
		pBn.add(bt20);
		
		buildDTM11();				//初始化房间类型列表和下拉列表的值
		buildDTM12("");				//初始化房间号列表
		
		
		//房间信息列表及四个按钮
		bt15 = new TJButton ("pic/new.gif", "单个添加", "添加单个房间信息");
		bt16 = new TJButton ("pic/book.gif", "批量添加", "批量添加房间信息");
		bt17 = new TJButton ("pic/del.gif", "删除房间", "删除某个房间信息");
		bt18 = new TJButton ("pic/modi0.gif", "修改房间", "修改某个房间信息");
		pBcc.add(sp12);
		pBcs.add(bt15);
		pBcs.add(bt16);
		pBcs.add(bt17);
		pBcs.add(bt18);
		pBc.add(pBcc);
		pBc.add("South",pBcs);
		pBc.setBorder ( BorderFactory.createTitledBorder ("房间信息") );
		
		//完成下半部分
		pBott.add("North",pBn);
		pBott.add(pBc);
		
		//组合
		pfangjian.add(pTop);
		pfangjian.add(pBott);
		
		return pfangjian;
	}
	
	//
	/**=======================================================================**
	 *		[## private void buildDTM11() {} ]: 
	 *			参数   :无
	 *			返回值 :无
	 *			修饰符 :private
	 *			功能   :房间类型列表和ComboBox
	 **=======================================================================**
	 */
	private void buildDTM11() {
		String sqlCode2 = "select pk,sysmark,id,foregift,r_type 房间类型," +
		"price 预设单价,cl_price " + "'钟点价格/小时'" + ",bed 床位数量,cl_room "+
		"'能否按钟点计费(Y/N)' from roomtype where delmark = 0";
		sunsql.initDTM(dtm11,sqlCode2);
		tb11.removeColumn(tb11.getColumn("pk"));
		tb11.removeColumn(tb11.getColumn("sysmark"));
		tb11.removeColumn(tb11.getColumn("foregift"));
		tb11.removeColumn(tb11.getColumn("id"));
		
		String sqlCode1 = "select r_type from roomtype where delmark = 0";
		sunsql.initJComboBox(cb11,sqlCode1);
		cb11.addItem("显示全部房间信息");
		cb11.setSelectedIndex(cb11.getItemCount() - 1);		//设置显示全部
	}
	
	/**=======================================================================**
	 *		[## private void buildDTM12(String rType) {} ]: 
	 *			参数   :String rType为刷新参数
	 *			返回值 :无
	 *			修饰符 :private
	 *			功能   :房间信息表
	 **=======================================================================**
	 */
	public void buildDTM12(String rType) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -