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

📄 hotal.java

📁 JAVA开发的酒店管理系统
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import mypackage.flag.myflag;

public class hotal extends JFrame{
	myflag f=new myflag();
	db_manager db=new db_manager();
  
	  JMenu   sys;
	  JMenu   ruzhu_manager;
	  JMenu   kongfang_manager;	
	  JMenu   help_menu;
	  JMenu  guanli_chaozuo;
	
	  JMenuItem close;
	  JMenuItem help;
	  JMenuItem about;
	  
	  JMenuItem add_user;
	  JMenuItem password_edit;
	  JMenuItem die;
	  JMenuItem tuichu;
	
	  JMenuItem new_login;
      JMenuItem  kehu_search;
      JMenuItem  money_search;
	 
	  JMenuItem  kongfang_search;
	  JMenuItem history;
	
	  JMenuItem tuifang;
	  JButton manager_login;
   private void make_GUI(){
	
	  
		JMenuBar menu=new JMenuBar();
	    setJMenuBar(menu);
 	

	    sys=new JMenu("系统");
		close=new JMenuItem("关闭");
		about=new JMenuItem("关于");
		sys.add(about);
	    sys.add(close);
		
		help_menu=new JMenu("帮助");
		help=new JMenuItem("帮助");
		help_menu.add(help);
		
		ruzhu_manager=new JMenu("入住管理");
		new_login=new JMenuItem("新客户登记");
		kehu_search=new JMenuItem("客户查询");
		money_search=new JMenuItem("帐单查询");
		ruzhu_manager.add(new_login);
		ruzhu_manager.add(kehu_search);
		ruzhu_manager.add(money_search);
		
		kongfang_manager =new JMenu("房间信息管理");
		kongfang_search =new JMenuItem("空房查询");
		tuifang=new JMenuItem("客户退房");
		history=new JMenuItem("历史记录查询");
		kongfang_manager.add(kongfang_search);
	   kongfang_manager.add(tuifang);
		kongfang_manager.add(history);

		
		guanli_chaozuo=new JMenu("管理员操作");
		add_user=new JMenuItem("增加管理员");
		password_edit=new JMenuItem("密码修改");
		tuichu=new JMenuItem("退出");
		die=new JMenuItem("注销");
		guanli_chaozuo.add(add_user);
		guanli_chaozuo.add(password_edit);
		guanli_chaozuo.add(tuichu);
		guanli_chaozuo.add(die);
		
		menu.add(sys);
		menu.add(ruzhu_manager);
		menu.add(kongfang_manager);
		menu.add(guanli_chaozuo);
		menu.add(help_menu);
		
		Container cp=getContentPane();
		cp.setLayout(new FlowLayout());
		 manager_login=new JButton("管理员登陆");
		 JTextArea aa=new JTextArea("房间价格表:普通单间/100"+"\n"+"普通单间/150 ,"+"单标间/150");
	      aa.append("\n"+"双标间/200 ,"+"夜间50~100");
		 aa.setEditable(false);
		JPanel jp=new JPanel();
		JPanel jp2=new JPanel();
		jp2.add(aa);
	    jp.setLayout(new FlowLayout());
		jp.add(manager_login);
		cp.add(jp,BorderLayout.NORTH);
		cp.add(jp2,BorderLayout.SOUTH);

     	setSize(400,300);
		setVisible(true);	
}
public void menu_action(){
	
		//管理员登陆
	manager_login.addActionListener(
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
			if(f.flag) JOptionPane.showMessageDialog(null,"已经登陆!");	
		   else	 new manager_login();
				
		
				
			}
		}
		);
		//管理员操作	
		add_user.addActionListener(
			new ActionListener(){
				public void actionPerformed(ActionEvent e){
					//加入代码
					if(!f.flag) JOptionPane.showMessageDialog(null,"请先登陆");
					 else new user_add();
				}
			});
			
			die.addActionListener(
			new ActionListener(){
				public void actionPerformed(ActionEvent e){
					//加入代码
					if(!f.flag) JOptionPane.showMessageDialog(null,"您没有权限,请先登陆!");
				else{
					if(JOptionPane.showConfirmDialog(null,"确定要注销 ? (删除当前用户)")==0){
				
					
						 String sql="delete from admin where admin="+"'"+f.username+"'";
					 if(db.executeSql(sql))  {
					 	JOptionPane.showMessageDialog(null,"成功注销!");
					 f.flag=false;
					 f.username="";
					 
					 }
		              else  JOptionPane.showMessageDialog(null,"注销失败!");
				}}
				}
			});
		password_edit.addActionListener(
			new ActionListener(){
				public void actionPerformed(ActionEvent e){
					
					//加入代码
					if(!f.flag) JOptionPane.showMessageDialog(null,"您没有权限,请先登陆!");
					else new password_edit();
				}
			});
		    //系统退出
	close.addActionListener(
			new ActionListener(){
				public void actionPerformed(ActionEvent e){
					System.exit(0);
				}
			});
			//管理员退出
			
	tuichu.addActionListener(
			new ActionListener(){
				public void actionPerformed(ActionEvent e){
					if(!f.flag) JOptionPane.showMessageDialog(null,"你没有登陆呢!");
				else{
					if(JOptionPane.showConfirmDialog(null,"确定要退出")==0){
						f.flag=false;
					f.username="";
					JOptionPane.showMessageDialog(null,"成功退出!");
					}
				
				}
				
				}
			});
			
	//帮助文件		
	help.addActionListener(
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
			new help();
			}
		}
		);	
	//版权申明		
	about.addActionListener(
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
				JOptionPane.showMessageDialog(null,"酒店客房管理系统 v1.0"+"\n"+"@制作:马贤军"+"\n"+"2006年8月13号");
			}
		}
		);	
	//新用户登记界面	
   new_login.addActionListener(
		new ActionListener(){
			public void actionPerformed(ActionEvent e){ 
				if(!f.flag) JOptionPane.showMessageDialog(null,"您没有权限,请先登陆!");		
	else{

			new_login addnew=new new_login();
				addnew.setBounds(160,140,400,350);
				addnew.validate();
			
				addnew.setVisible(true);
				//JOptionPane.showMessageDialog(null,"建设中。。。。");
			
			}	}
		}
		);
		//客户房间查询
		kehu_search.addActionListener(
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
				
				new kehu_select();
			
			}
		}
		);						
		
		//帐单查询


		
		money_search.addActionListener(
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
				
		if(!f.flag) JOptionPane.showMessageDialog(null,"您没有权限,请先登陆!");		
	 else{new money_search();
		
		}
				
			
			}
		}
		);	
		
		
		
		
		//空房查询
		kongfang_search.addActionListener(
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
				
				new empty_select();
				
			}
		}
		);	
		//客户退房管理
		tuifang.addActionListener(  
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
		if(!f.flag) JOptionPane.showMessageDialog(null,"您没有权限,请先登陆!");		
	  else{
			new	kehu_exit();
			}}
		}
		);
		//历史记录查询
		history.addActionListener(  
		new ActionListener(){
			public void actionPerformed(ActionEvent e){
		if(!f.flag) JOptionPane.showMessageDialog(null,"您没有权限,请先登陆!");		
	  else{
			new	history_search();
			}}
		}
		);		
						
}

 public hotal(){
	  super("酒店客房住宿管理系统 V1.0");
	  make_GUI();
	  menu_action();
	 }		
	

public static void main(String[] args){
	hotal h=new hotal();
   
	
	}
}

⌨️ 快捷键说明

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