符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
本文实例为大家分享了java实现客房管理系统的具体代码,供大家参考,具体内容如下
成都创新互联是专业的袁州网站建设公司,袁州接单;提供网站建设、网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行袁州网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
AddClient.java
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.Calendar; import javax.naming.spi.DirStateFactory.Result; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; public class AddClient extends JFrame implements ActionListener{ JTextField sname,ID,age,home_addr,employer,phone,cno,rno,intime,outtime,days,cashpledge; JButton save,cancel,save1; JPanel pl,pl1,pl2,pl3,pl4,pl5,pl6,pl7,pl8,pl9,pl10,pl11,pl12,pl13,pl14,pl15,pl16; JRadioButton man,wuman,yes,no; ButtonGroup group,group1; String sex,vip; int k,k1,k2; public AddClient(){ pl=new JPanel(); pl1=new JPanel(); pl2=new JPanel(); pl3=new JPanel(); pl4=new JPanel(); pl5=new JPanel(); pl6=new JPanel(); pl7=new JPanel(); pl8=new JPanel(); pl9=new JPanel(); pl10=new JPanel(); pl11=new JPanel(); pl12=new JPanel(); pl13=new JPanel(); pl14=new JPanel(); pl15=new JPanel(); pl16=new JPanel(new FlowLayout(FlowLayout.CENTER,20,20)); sname=new JTextField(15); ID=new JTextField(15); age=new JTextField(15); home_addr=new JTextField(15); employer=new JTextField(15); phone=new JTextField(15); cno=new JTextField(15); rno=new JTextField(15); intime=new JTextField(15); outtime=new JTextField(15); days=new JTextField(15); cashpledge=new JTextField(15); group=new ButtonGroup(); group1=new ButtonGroup(); man=new JRadioButton("男",true); wuman=new JRadioButton("女",false); yes=new JRadioButton("是",true); no=new JRadioButton("否",false); group.add(man); group.add(wuman); group1.add(yes); group1.add(no); pl1.add(new JLabel("姓名: ",JLabel.RIGHT)); pl1.add(sname); pl2.add(new JLabel("身份证号:",JLabel.RIGHT)); pl2.add(ID); pl3.add(new JLabel("性别: ",JLabel.RIGHT)); pl3.add(man); pl3.add(wuman); pl4.add(new JLabel("VIP客户:")); pl4.add(yes); pl4.add(no); pl5.add(new JLabel("年龄: ",JLabel.RIGHT)); pl5.add(age); pl6.add(new JLabel("家庭地址:",JLabel.RIGHT)); pl6.add(home_addr); pl7.add(new JLabel("工作单位:",JLabel.RIGHT)); pl7.add(employer); pl8.add(new JLabel("手机号: ",JLabel.RIGHT)); pl8.add(phone); pl.setBorder(BorderFactory.createTitledBorder("客户 信息")); pl.setLayout(new GridLayout(4,2,10,10)); pl.add(pl1); pl.add(pl2); pl.add(pl3); pl.add(pl4); pl.add(pl5); pl.add(pl8); pl.add(pl7); pl.add(pl6); pl9.add(new JLabel("房号: ",JLabel.RIGHT)); pl9.add(rno); pl10.add(new JLabel("入住时间:",JLabel.RIGHT)); pl10.add(intime); pl11.add(new JLabel("预离店时间",JLabel.RIGHT)); pl11.add(outtime); pl12.add(new JLabel("入住天数:",JLabel.RIGHT)); pl12.add(days); pl13.add(new JLabel("预交押金:",JLabel.RIGHT)); pl13.add(cashpledge); pl14.add(new JLabel("入住序号:",JLabel.RIGHT)); pl14.add(cno); pl15.setBorder(BorderFactory.createTitledBorder("客户入住 信息")); pl15.setLayout(new GridLayout(3,2,15,15)); pl15.add(pl14); pl15.add(pl9); pl15.add(pl10); pl15.add(pl11); pl15.add(pl12); pl15.add(pl13); save=new JButton("登记入住"); cancel=new JButton("取消"); save1=new JButton("添加家属"); save.addActionListener(this); cancel.addActionListener(this); save1.addActionListener(this); pl16.add(save); pl16.add(save1); pl16.add(cancel); add(pl,BorderLayout.NORTH); add(pl15,BorderLayout.CENTER); add(pl16,BorderLayout.SOUTH); setBounds(600,300,600,600); setTitle("客户入住信息"); setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==save){ int result=JOptionPane.showConfirmDialog(null, "确认提交吗", "温馨提示", JOptionPane.YES_NO_OPTION); if (result==0) { if(man.isSelected()){ sex="男"; } else{ sex="女"; } if(yes.isSelected()){ vip="是"; } else{ vip="否"; } try { Class.forName(Url.driver); Connection con=DriverManager.getConnection(Url.url,Url.username,Url.userpwd); Statement sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); k=sql.executeUpdate("insert into Client values('"+sname.getText()+"','"+ID.getText()+"','"+sex+"','"+age.getText()+"','"+home_addr.getText()+"','"+employer.getText()+"','"+vip+"','"+phone.getText()+"')"); k1=sql.executeUpdate("insert into Check_in(Cno,Rno,Intime,Outtime,Dayss,Cashpledge) values('"+cno.getText()+"','"+rno.getText()+"','"+intime.getText()+"','"+outtime.getText()+"','"+days.getText()+"','"+cashpledge.getText()+"')"); k2=sql.executeUpdate("insert into Type_in values('"+cno.getText()+"','"+ID.getText()+"')"); if (k==1&&k1==1&&k2==1) { int result1=JOptionPane.showConfirmDialog(null, "入住成功!是否添加家属信息?", "温馨提示", JOptionPane.YES_NO_OPTION); if(result1==0){ ID.setText(""); sname.setText(""); age.setText(""); home_addr.setText(""); phone.setText(""); employer.setText(""); } else { dispose(); } } }catch(Exception e1){ JOptionPane.showMessageDialog(this, "入住失败"); } } } if(e.getSource()==cancel){ dispose(); } if(e.getSource()==save1){ int result=JOptionPane.showConfirmDialog(null, "确认提交吗", "温馨提示", JOptionPane.YES_NO_OPTION); if (result==0) { if(man.isSelected()){ sex="男"; } else{ sex="女"; } if(yes.isSelected()){ vip="是"; } else{ vip="否"; } try { Class.forName(Url.driver); Connection con=DriverManager.getConnection(Url.url,Url.username,Url.userpwd); Statement sql=con.createStatement(); k=sql.executeUpdate("insert into Client values('"+sname.getText()+"','"+ID.getText()+"','"+sex+"','"+age.getText()+"','"+home_addr.getText()+"','"+employer.getText()+"','"+vip+"','"+phone.getText()+"')"); k2=sql.executeUpdate("insert into Type_in values('"+cno.getText()+"','"+ID.getText()+"')"); if (k==1&&k2==1) { int result1=JOptionPane.showConfirmDialog(null, "入住成功!是否继续添加家人信息?", "温馨提示", JOptionPane.YES_NO_OPTION); if(result1==0){ ID.setText(""); sname.setText(""); age.setText(""); home_addr.setText(""); phone.setText(""); employer.setText(""); } else { dispose(); } } }catch(Exception e1){ JOptionPane.showMessageDialog(this, "添加失败"); } } } } }
AdminFrame.java
import java.awt.BorderLayout; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; class AdminFrame extends JDialog implements ActionListener{ JLabel label = new JLabel(); JMenuBar mBar= new JMenuBar(); private JMenu Quarto,message,Clinet; private JMenuItem item1,item2,item3,item4,item5,item6,item7,item8,item9; JPanel pl1; Container con; AdminFrame(){ pl1=new JPanel(); setJMenuBar(mBar); ImageIcon icon = new ImageIcon("src/picture/1.jpg"); label.setIcon(icon); label.setBounds(0,0, 600, 500); pl1.add(label); add(pl1); setBounds(600,300,600,500); Quarto=new JMenu("客房操作"); message=new JMenu("信息查询"); Clinet=new JMenu("统计客房相关信息"); mBar.add(Quarto); mBar.add(message); mBar.add(Clinet); item3=new JMenuItem("查询客房"); item1=new JMenuItem("入住登记"); item2=new JMenuItem("退房操作"); Quarto.add(item1); Quarto.addSeparator(); Quarto.add(item2); Quarto.addSeparator(); Quarto.add(item3); item4=new JMenuItem("客人信息查询"); item5=new JMenuItem("客房时间查询"); item6=new JMenuItem("客人费用查询"); message.add(item4); message.addSeparator(); message.add(item5); message.addSeparator(); message.add(item6); item7=new JMenuItem("各类房型入住情况"); item8=new JMenuItem("各月份客房收入"); Clinet.add(item7); Clinet.addSeparator(); Clinet.add(item8); item1.addActionListener(this); item2.addActionListener(this); item3.addActionListener(this); item4.addActionListener(this); item5.addActionListener(this); item6.addActionListener(this); item7.addActionListener(this); item8.addActionListener(this); setVisible(false); setTitle("客房管理系统"); validate(); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==item1){ AddClient stu=new AddClient(); stu.setVisible(true); } if(e.getSource()==item2){ Left left=new Left(); left.setVisible(true); } if (e.getSource()==item3) { QueryRoom qr=new QueryRoom(); qr.setVisible(true); } if (e.getSource()==item4) { QueryClient qc=new QueryClient(); qc.setVisible(true); } if(e.getSource()==item5){ QueryTime qt=new QueryTime(); qt.setVisible(true); } if(e.getSource()==item6){ QueryCost qc=new QueryCost(); qc.setVisible(true); } if(e.getSource()==item7){ StatisticsInformation si=new StatisticsInformation(); si.setVisible(true); } if(e.getSource()==item8){ Income income=new Income(); income.setVisible(true); } } }
完整代码:java实现客房管理系统
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。